GNOME Bugzilla – Bug 687552
Improve palette sorting functionality (patch)
Last modified: 2012-12-13 00:52:07 UTC
Created attachment 228011 [details] diff adding new features At Joao's suggestion, per my post to the gimp-developer mailing list: I've made some major upgrades to the 'sort palette' plugin. 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. Updated plugin and diff 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: http://i.imgur.com/CH7JF.png I first sort the entire palette by LCH hue, so that the partitioning works best: http://i.imgur.com/YNmt7.png Then sort by LAB with LCH Hue partitioning(granularity 16): http://i.imgur.com/DXgVW.png The result is this palette, ordered along two dimensions: http://i.imgur.com/tGPjV.png
Created attachment 228012 [details] updated plugin
The final version is attached, in both file and patch format. Notably, error detection is improved, behaviour in the remaining corner cases is defined, and two new sort 'channels' are available: 'Index' (good for quickly reversing the palette or a subsection thereof), and 'Random'. I've recorded a screencast reviewing its functionality, which I'm working on uploading to YouTube. Everything except the Index and Random channels are covered by it.
Created attachment 228080 [details] [review] final diff
Created attachment 228081 [details] final plugin
Created attachment 228089 [details] updated final plugin bugfix: Index and Random didn't have GRAIN_SCALEs defined.
Created attachment 228090 [details] [review] updated final diff
I have no clue what you are doing there, but so be it :) commit 579a1a259ad87de7a1cb5a86ef926411c05011c7 Author: Michael Natterer <mitch@gimp.org> Date: Wed Nov 7 22:51:22 2012 +0100 Bug 687552 - Improve palette sorting functionality Apply patch from David Gowers that adds more options to the sort palette plug-in. plug-ins/pygimp/plug-ins/palette-sort.py | 311 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 283 insertions(+), 28 deletions(-)
For the record, the screencast (which covers all the new functionality, and incidentally most of the old functionality) is available at: Part 1/4: http://www.youtube.com/watch?v=_8e5Uvhn6vs Part 2/4: http://www.youtube.com/watch?v=Nb4mNs-2ARo Part 3/4: http://www.youtube.com/watch?v=_1UprDMsPlw Part 4/4: http://www.youtube.com/watch?v=p_NlcsTzmfk Hopefully this will be helpful to anyone updating the docs.
You have to notify romanofski directly, adding comments to closed bugs usually has zero effect, nobody sees this :)