Anne van Kesteren

PNG Gamma “Correction”

For a client I recently had to convert a nice PNG image to a GIF image (which are now patent free), since Safari screwed up the colors. After reading The Sad Story of PNG Gamma “Correction” I know why:

Of the latest versions of various PNG-supporting browsers (at the time of writing in April 2003), Safari is the problem: It applies a gamma change to unlabeled PNGs. This means unlabeled PNGs are not an option for those who want consistent colors in CSS and PNG in Safari.

I hope Dave Haytt from Safari is going to fix this as soon as possible. Although it isn't really a bug, it does mean that PNG images can't be used when colors are important. Why do we have this problem you wonder:

The emphasis was put on doing some change to the gamma instead of emphasizing consistency with the surrounding colors in browsers. Also, guessing the gamma based on the operating system was presented as an acceptable method in the specification itself. That is, doing something was emphasized over correctness and consistency.

I think I switch to using CSS for images, at least that is consistent with the other CSS colors used.

Comments

  1. That makes me wonder, though: does Safari `mess up` on black-and-white alphatransparent PNG's? Like, PNG's that have no color in them, but are applied over blocks of color.

    Posted by Faruk Ates at

  2. To solve the gamma problem, drop in a 2x2px PNG background image, instead of using a background color somewhere. Safari will use that gamma for the rest of the PNGs.

    Posted by David at