How to remove ICC profile information from PNG images (from Web Interface)

Some images contain color correction information (ICC) and result in showing differently in web browsers.

This was also the case with customer logo showing different colors on my Citrix Web Interface.  My PNG images were showing different in Internet Explorer 7 on vista, but corr
ectly on all other browsers.
Although the logo was saved with color #395984, it showed as #2F4E7A in Internet Explorer 7. Not cool, man!

 

Example  

Web Interface png images

The Color is different due to icc profile information stored into the existing PNG. 

Now the obvious way to solve this is migrate away from vista, and luckily the customer was running a project to do so, but anyway, a fix has to be implemented.

Why does this happen?

Well, I feel a little lazy right now, so I let other people explain that to you now 🙂

http://forums.getpaint.net/index.php?/topic/26228-png-saved-from-paintnet-appearing-different-than-png-saved-in-photoshop/

Solution

Since you are mostly interested in solving this problem, let’s cut right to the chase, shall we?

1. Found a tool called PNGcrush
http://en.wikipedia.org/wiki/Pngcrush

2. Downloaded it here: http://pmt.sourceforge.net/pngcrush/ 

3. And had it process my PNG to remove all the following attributes (read:junk) below:

c:\pngcrush_1_7_60_w32.exe -rem gAMA -rem cHRM -rem iCCP -rem sRGB CitrixXenApp.png CitrixXenApp_withoutICCrubbish.png 

| pngcrush 1.7.60
| Copyright (C) 1998-2002, 2006-2013 Glenn Randers-Pehrson
| Portions copyright (C) 2005 Greg Roelofs
| This is a free, open-source program. Permission is irrevocably
| granted to everyone to use this version of pngcrush without
| payment of any fee.
| Executable name is pngcrush_1_7_60_w32
| It was built with libpng version 1.5.16, and is
| running with libpng version 1.5.16 – May 23, 2013 
| Copyright (C) 1998-2004, 2006-2013 Glenn Randers-Pehrson,
| Copyright (C) 1996, 1997 Andreas Dilger
| Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,
| and zlib version 1.2.8, Copyright (C) 1995 (or later),
| Jean-loup Gailly and Mark Adler.
| It was compiled with gcc version 4.8.0 20121015 (experimental).
Recompressing CitrixXenApp.pngTotal length of data found in critical chunks = 19082Critical chunk length, method 1 (ws 15 fm 0 zl 4 zs 0) = 17429
Critical chunk length, method 2 (ws 15 fm 1 zl 4 zs 0) > 17429
Critical chunk length, method 3 (ws 15 fm 5 zl 4 zs 1) > 17429
Critical chunk length, method 4 (ws 15 fm 0 zl 9 zs 1) > 17429
Critical chunk length, method 7 (ws 15 fm 0 zl 9 zs 0) = 16954
Removed the gAMA chunk.

Best pngcrush method = 7 (ws 15 fm 0 zl 9 zs 0) = 16954
for CitrixXenApp1.png
(11.15% critical chunk reduction)
(11.19% filesize reduction)
 CPU time decoding 0.032, encoding 0.199, other 0.036, total 0.267 seconds

 

Renamed and copied the PNG in the right location: C:\inetpub\wwwroot\Citrix\XenApp\media\ and tested with Internet Explorer 7 (the culprit!) and Chrome (btw the only browser that will survive the browser war).

Problem solved!

Fixed PNG image from icc and other profile info

Like or share the article if it helped you. Will make it easier for other people to find the solution in Google search. 

Leave a Reply

Your email address will not be published. Required fields are marked *