Possible PNG palette bug in IE 8 Beta 1
- Saturday 24 May 2008 13:19 by Rupert Benbrook
- 6 Comments
Some of the observant amongst you out there (if anyone's reading?!) will have noticed I'm putting together a new design for this site. It's not quite there yet, but I did come across a possible bug in the way that IE8 renders PNG images. If you look at the top of this page you'll see there's a header image of some trees which fades out at the left and right edges to a cross hatch of two shades of green. This header image butts up against another image at the left and right edges, which is a continuation of the same cross hatch. The header image is in JPEG format, and the cross hatch continuation is in PNG format. Compare what this join looks like in a screen capture close up, between Firefox 3.0 RC1 and IE 8.0 Beta 1, Firefox at the top, IE8 below:
Look closely. The shade of green in the IE8 image is slightly darker than the Firefox image. When you look at the whole page in Firefox you can't see the transition between the images, which is what I want, but in IE8 it's really distinct. The two shades of green that should be in the cross hatch are #006600 and #003300. From the Firefox screen capture that's exactly what I get. But from the IE8 screen capture I actually get #005b00 and #002a00. Close, but no cigar. I've tried in both Emulate IE7 mode and full IE8 mode, and it's the same. I also haven't checked any other browsers yet. However, if I switch the format of the cross hatch continuation image to GIF, instead of PNG, then IE8 gets it right and reproduces the greens exactly how I'd like.
Has anyone else come across this problem?

What others are saying
Paul Higginbottom
This is not a new problem with IE8, I've had PNG palettes displayed wrong on IE6 and IE7 also, and can't figure out a solution except to use GIFs instead. Very annoying.
Paul Higginbottom
OK, the bug is actually described here:
en.wikipedia.org/.../Portable_Networ
Solution is to remove the gAMA chunk from PNGs (somehow).
Paul Higginbottom
And this tool DOES actually fix it!!!!
psydk.org/.../PngOptimizer.ph
Rupert Benbrook
Thanks for the comments Paul. I've been having a more detailed look at this and I think I can make Firefox 3 exhibit the same behaviour as IE by turning on colour correction, which is off by default.
Paul Higginbottom
Buried in the page at the wiki link I gave which maybe you didn't catch is this:
"Internet Explorer ≤6 also renders PNGs in a slightly incorrect color gamut. If a GIF and PNG image of several colors are placed side-by-side on a page, a user can often see a slight difference in color. This is due to an incorrect handling of the gAMA ancillary chunk. Tools exist to get rid of these chunks, ..."
The free tool I gave a link to above removes this chunk and I have PNGs working perfectly right now in IE6, IE7, FF2. Plus getting rid of the extra metadata chunks makes the files a lot smaller!
Rupert Benbrook
Thanks again Paul, and you're right. So I've switched back to using PNGs, instead of GIFs. In the end I used a tool called TweakPNG, which you can get from http://entropymine.com/jason/tweakpng/.