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 616138 - Inaccurate colormap choices when converting RGB to indexed
Inaccurate colormap choices when converting RGB to indexed
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.6.8
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2010-04-18 22:42 UTC by Ari Pollak
Modified: 2016-11-16 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test .ppm (47 bytes, image/x-portable-pixmap)
2010-04-18 22:43 UTC, Ari Pollak
Details
test colormap (49 bytes, application/octet-stream)
2010-04-18 22:43 UTC, Ari Pollak
Details

Description Ari Pollak 2010-04-18 22:42:46 UTC
From http://bugs.debian.org/577623:

When converting an RGB image to indexed, the GIMP sometimes fails to
choose as accurately as it could between similar colors in a chosen
palette, even when each pixel has an exact match somewhere in the
palette.

The enclosed colormaptest.ppm and Colormap_test files together form a
test case to reproduce this bug, as follows:

1. Compare colormaptest.ppm (a text PPM image) and Colormap_test (a GIMP
   palette) to verify that each contains the same RGB triples in the
   same order.
2. Move or copy Colormap_test into a directory for GIMP palettes, e.g.,
   the ~/.gimp-2.6/palettes/ directory.
3. Start the GIMP and open colormaptest.ppm, then zoom in enough that
   you can see each individual pixel.
4. Right-click image -> Image -> Mode -> Indexed... to open the Indexed
   Color Conversion dialogue, and set it as follows:
   a. Under "Colormap", select "Use custom palette", then click the
      button below that selection to pop up the list of 
      available palettes.  From this list select "Colormap_test".
      Uncheck the "Remove unused colors from colormap" checkbox if it's
      checked.
   b. Under "Dithering", for "Color dithering:" select "None".  Uncheck
      the "Enable dithering of transparency" checkbox if it's checked.
   c. Click "Convert".
5. Observe that while the leftmost and middle pixels have been mapped to
   their exact matches in the palette, the rightmost pixel has been
   mapped to the same color as the middle pixel.  (Try pressing ^Z to
   undo and ^Y to redo repeatedly if you don't see it at first.)
Comment 1 Ari Pollak 2010-04-18 22:43:13 UTC
Created attachment 159040 [details]
test .ppm
Comment 2 Ari Pollak 2010-04-18 22:43:40 UTC
Created attachment 159041 [details]
test colormap
Comment 3 Sven Neumann 2010-04-20 18:51:29 UTC
Duplicate of bug #66257 ?
Comment 4 Ari Pollak 2010-04-20 19:20:13 UTC
I'm not positive, but that bug looks more related to generating an optimal palette.
Comment 5 mwmiller 2010-04-24 04:15:01 UTC
Greetings from Debian (l)userland! As far as already-existent bug reports go, this one seems to mostly resemble bug #421751, and its clone, bug #602632.

After reading the mention in bug #421751 that the conversion works in CIE-LAB colorspace, I think it would be best to work straight in RGB space so as to minimize odd colormap choices like these. After examining the code in question (app/core/gimpimage-convert.c) for a bit, though...good grief it's a mess. I don't think the proper solution is to take out indexed mode entirely (as Michael Schumacher mentions in bug #602632 comment 2), though, so I'd like to help fix it properly, presuming somebody or another has managed to "find time to debug" in the intervening THREE YEARS since the bug was first reported. :)
Comment 6 Michael Schumacher 2015-07-22 20:18:45 UTC
Another bug to reevaluate for 2.10.
Comment 7 Michael Natterer 2016-11-16 16:09:59 UTC
I don't know what has changed, but converting to a palette that
contains *all* the image's colors seems to work now in master.
The attached test case produces identical colors after indexed
conversion.