[Gimp-developer] Upgraded palette-sort.py plugin

I got tired of being unable to get any use out of the 'sort palette' plugin and made some major upgrades. I'm not quite ready to say this is 'done' yet -- it has some UI that I'm thinking about changing -- but it's fully functional and much more effective than the old plugin. Attached.

These improvements include:

* General cleanups (eg. don't use old python conventions like cmp functions)

* Support for sorting by luma aka Y, S of HSL, L of HSL

* If you have 'colormath' module installed, support for sorting by L of LAB/LCH, A of LAB, B of LAB, Chroma of LCH(ab), or Hue of LCH(ab). These are generally superior to their HSV/HSL/YIQ counterparts; I use them exclusively.

* Option to sort only a selected slice of the palette (for example a color ramp that has become disorganized)

* Option to quantize the sorting (so eg. you can sort into 6 distinct hue categories rather than 360.). Useful for subdividing the palette into sections.

* Option to automatically find and sort individual 'partitions' (blocks of 'constant' value in a given channel, after they are quantized.), in either the entire palette or a selected slice of it. Useful for sorting say 16 different categories of Hue by Lightness -- each partition's contents are individually sorted, so this is quite different from what you get if you sort first by Hue and then by Lightness (with no partitioning).

An example of usage:
Starting from this palette:


I first sort the entire palette by LCH hue, so that the partitioning works best:


Then sort by LAB with LCH Hue partitioning(granularity 16):


The result is this palette, ordered along two dimensions:


I would have also posted this to the Plugin Registry, but I haven't figured out how!

Feedback is welcomed (I hope I'm still subscribed to gimp-developer ;)

Attachment: palette-sort.py
Description: Binary data

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]