GNOME Bugzilla – Bug 599065
PNG output: omit unwanted chunks (sRGB)
Last modified: 2011-02-02 07:34:47 UTC
I don't know when this started happening, but GIMP 2.6.7 (here in Ubuntu Karmic beta) is saving all PNGs with some chunks that are likely to be pointless (bKGD on an image with no alpha; pHYs; tIME), and one in particular that is actively harmful: sRGB. This happens even when colour management is disabled in the preferences, and it puts the chunks back in even when editing a PNG that originally didn't have them. *This is an absolute disaster for web authors.* sRGB doesn't help retain any colour information (being as it is an arbitrary uncalibrated colour space), but it *does* nicely screw up rendering in web browsers. The situation with gAMA on the web is bad enough without introducing this extra obstacle. Having to pngcrush every file after every edit is an absurd situation. Please include a checkbox on the PNG export to omit these chunks, and disable sRGB by default. It represents nothing more than a stealthy trap and impediment to GIMP use for web designers.
I agree that we are currently setting an sRGB color profile rather arbitrary. Let's try to come up with a better strategy for 2.8.
I am tempted to close this bug and wait for a better description of the actual problem. The Chunks mentioned in the report can be individually controlled in the plugin dialog, the default set of chunks can be stored in the preferences. Ok, sRGB probably is a quite notable exception to that, but then it actually is the working space of GIMP and I don't understand why it would be an "arbitrary uncalibrated colour space" (it *is* well defined). And up to now this is the first complaint I hear about this, which makes it unlikely to be an absilute disaster. *shrug*
OK, I seem to be mistaken about the other chunks; I can't reproduce them getting added when the options are turned off now. But the sRGB problem is easy to see. Create a new image blue.png of solid blue, save and put it on top of a <body bgcolor="#0000FF">. On Firefox 3.5 under Ubuntu at least (and, according to the tests at http://hsivonen.iki.fi/png-gamma/, other browsers too), the colours will fail to match (by quite some way). It is widely accepted that PNGs for web use should be unlabelled (no specified colour space).
Right now we set sRGB on the PNG if there is no gamma value set. This is not the first complaint we have had about this, it's more like the tenth (including complaints in #gimp). If I recall correctly me and Sven already talked about this and agreed to do something about it, although right now I don't remember what it was, but I'm pretty sure I can figure it out again when I do a git blame. Keeping this bug report open is a simple way to remind ourselves of that we need to do something. We could close this and create a new bug report, but I don't see the point in doing that, might as well reuse this one.
Here is a thread where this was discussed: http://lists.xcf.berkeley.edu/lists/gimp-developer/2009-February/021581.html
This may be an older bug, but it still very much hurts myself as a web developer. I have used GIMP loyally for a while to do web development work, but in more recent Firefox versions it does break when trying to use images created with GIMP with other, HTML-set colors. Not even the save for web plugin has the ability to fix this, which I had hoped would. Anyway, PLEASE fix this since it so that GIMP is usable for the web again. By the way, the commit by Omari Stephens in January (can be seen at http://codepad.org/7e3cWDhm ) doesn't seem to fix this. I patched GIMP, recompiled then reinstalled, but still it saves images with the sRGB bit. I checked them with Firefox, and indeed its showing the image with colors off by a lot.
Actually scratch that last comment, Omari's patch does work, I just forgot to change a setting back in Firefox. Still, this bug did make it a pain without the patch. :\
I recently got burned by this behavior and got tired of it, so I push this commit: commit ed872c7c6e53a187e76e06f9a081c91370466f92 Author: Omari Stephens <xsdg@xsdg.org> Date: Sun Jan 30 21:34:19 2011 +0100 Bug 599065 - PNG output: omit unwanted chunks (sRGB) If the image has neither a gamma set nor a color profile set, then we should leave the image untagged. We should not tag as sRGB by default because it is too arbitrary. This can be seen as a quick-fix before we have a consistent strategy for handling exporting and color profiles for the various file formats we support.