Remove Gamma from PNGs
Tuesday, June 26th, 2007Hopefully those of you that have been racking your brains trying to figure out why your colors in a PNG file don’t match those in a GIF or JPG, will find this small article useful. I ran across this problem when trying to use a PNG file to overlay a page background image was another file type such as GIF or JPG when both images needed to represent the same color. Firefox typically renders the images correctly, but I’ve found that IE6 and Safari have problems with it. To deal with the problem you need to remove the Gamma from the PNG file. Fortunately I ran across a program that will remove it for you: pngcrush.
The program can be downloaded for Windows and runs in command line DOS. If you are familiar with command line, just enter the following code (replacing infile and outfile with your file names):
pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB infile.png outfile.png
Refresh your page and watch the colors match :)