English

Keep colors consistent across OS and browsers with ImageMagick by removing profiles

Today we had a little battle with ImageMagick for our media handling product and learnt a simple trick for getting the most decent colors across different operating systems and browsers. Initially it was triggered by some images getting a nasty green “overlay” in Firefox. Some reading and verifying later it turns out FF 3.5+ does not support ICC v4 profiles — 3.0 did, they turned it off. Now, in general embedded color profiles is a little nightmare because of the very different ways they works in browsers.

The solution we ended on — that seems to work quite well in all OS+browser combinations — was to extract the color profile from the original image, then convert the image to use the ICC v2  black scaled  profile (available here at ICC’s site) and finally strip all color profiles from the image. The end result of this is the following two commands. Notice that you probably want to check that profile.icc is bigger than 0 bytes not that it matters to ImageMagick.

convert image.jpg profile.icc
convert image.jpg -profile profile.icc -profile /path/to/sRGB_IEC61966-2-1_black_scaled.icc -strip working-image.jpg

So far this seems to be working good, but leave a comment if you have suggestions to improve it or a better solution.

About Raymond Julin

Lead developer at Keyteq Labs, a product business in Bergen, Norway with a reputation for modern user friendly solutions.

1 Comment

  1. Working for me as well. May I ask why sRGB_IEC61966-2-1_black_scaled.icc particularly ? I am a noob at color profiles and haven’t researched much on this.

Leave a Reply