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 170825 - Incorrect indexing of mainly white B&W image using optimal palette.
Incorrect indexing of mainly white B&W image using optimal palette.
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-03-18 17:59 UTC by weskaggs
Modified: 2005-03-20 19:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
png file illustrating problem. (19.24 KB, image/png)
2005-03-18 18:01 UTC, weskaggs
  Details
The fix v1 (1.11 KB, patch)
2005-03-19 13:52 UTC, Adam D. Moss
none Details | Review

Description weskaggs 2005-03-18 17:59:36 UTC
Convert the grayscale (actually B&W) png attached below to indexed using
"optimal palette", and it comes out all black.  Problem first described in bug
#170801, which is about a different issue that has been resolved.
Comment 1 weskaggs 2005-03-18 18:01:15 UTC
Created attachment 38913 [details]
png file illustrating problem.

image generated by Xuân Baldauf, copied from attachment in bug #170801
Comment 2 Adam D. Moss 2005-03-19 13:17:09 UTC
Yeah, that's not good.  Note that if you convert the image to RGB first, things
are fine.

The grey->indexed code is really quite different from the RGB->indexed code, and
it's the latter that gets the most love.  I'm wondering how evil it would be to
do an implicit grey->RGB conversion before quantizing and throw away the crusty
grey->indexed code paths.
Comment 3 Adam D. Moss 2005-03-19 13:20:20 UTC
Looks like an int overflow in counting the white pixels.
Comment 4 Adam D. Moss 2005-03-19 13:52:03 UTC
Created attachment 38939 [details] [review]
The fix v1

I don't know (or more accurately don't remember) where the greyscale histogram
values get boosted enough to cause an int overflow, but this makes it a
non-issue.
Comment 5 Adam D. Moss 2005-03-19 13:53:55 UTC
Oh yeah, patch is against my tree (somewhere around gimp 2.0) but it hopefully
still applies to everything.
Comment 6 Adam D. Moss 2005-03-20 12:33:03 UTC
n.b. I will no longer respond to bug reports originating from California
National Primate Research Center, as I do not believe in supporting their work
in any way.  Someone else can field such reports.
Comment 7 weskaggs 2005-03-20 16:11:22 UTC
This is the sort of comment that generates flamewars.  Although it would be easy
for me to answer, I am not going to, and I hope that nobody else will feel
compelled to either, or that if you must, you can do it by sending private email
to Adam and/or me.
Comment 8 weskaggs 2005-03-20 19:06:22 UTC
Patch applies cleanly and seems to fix the problem, committed to both branches.

2005-03-20  Bill Skaggs  <weskaggs@primate.ucdavis.edu>

	* app/core/gimpimage-convert.c: applied patch from Adam
	Moss converning gray->indexed conversion,
	fixes bug #170825.

Resolving as FIXED although comment #4 is a bit worrying.  Thanks for the patch.