After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 687552 - Improve palette sorting functionality (patch)
Improve palette sorting functionality (patch)
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Gimp-Python
git master
Other All
: Normal enhancement
: 2.10
Assigned To: Manish Singh
GIMP Bugs
Depends on:
Blocks: 690135
 
 
Reported: 2012-11-04 09:07 UTC by David Gowers
Modified: 2012-12-13 00:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
diff adding new features (7.83 KB, text/plain)
2012-11-04 09:07 UTC, David Gowers
  Details
updated plugin (6.76 KB, text/x-python)
2012-11-04 09:09 UTC, David Gowers
  Details
final diff (13.04 KB, patch)
2012-11-05 09:02 UTC, David Gowers
none Details | Review
final plugin (11.70 KB, text/x-python)
2012-11-05 09:03 UTC, David Gowers
  Details
updated final plugin (11.75 KB, text/x-python)
2012-11-05 10:23 UTC, David Gowers
  Details
updated final diff (13.10 KB, patch)
2012-11-05 10:24 UTC, David Gowers
committed Details | Review

Description David Gowers 2012-11-04 09:07:42 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
Comment 1 David Gowers 2012-11-04 09:09:06 UTC
Created attachment 228012 [details]
updated plugin
Comment 2 David Gowers 2012-11-05 09:02:06 UTC
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.
Comment 3 David Gowers 2012-11-05 09:02:44 UTC
Created attachment 228080 [details] [review]
final diff
Comment 4 David Gowers 2012-11-05 09:03:56 UTC
Created attachment 228081 [details]
final plugin
Comment 5 David Gowers 2012-11-05 10:23:36 UTC
Created attachment 228089 [details]
updated final plugin

bugfix: Index and Random didn't have GRAIN_SCALEs defined.
Comment 6 David Gowers 2012-11-05 10:24:20 UTC
Created attachment 228090 [details] [review]
updated final diff
Comment 7 Michael Natterer 2012-11-07 21:53:51 UTC
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(-)
Comment 8 David Gowers 2012-12-12 22:32:19 UTC
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.
Comment 9 Michael Natterer 2012-12-12 23:48:49 UTC
You have to notify romanofski directly, adding comments to closed bugs
usually has zero effect, nobody sees this :)