Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong colours when converting TIFF image to PNG in ImageMagick

I'm working on a PHP script that automatically converts TIFF images to PNG files.

For that purpose, I use ImageMagick:

$ convert a.tif a.png

It works to some degree, however, the colours are very acute and deviant from the way they are pictured on my PC. To illustrate the problem, please have a look at the enclosed files, the include:

  • The Windows Live Foto Gallery output (that's pretty much how I want it to be)
  • The ImageMagick output (the mess I end up with)
  • The original TIFF file

Has anyone an idea whether, and if so how, I can alter the ImageMagick colour interpretation?

Thanks a lot!

like image 512
clausvdb Avatar asked Jul 26 '10 21:07

clausvdb


2 Answers

Alright,

thanks to ergosys, the problem was easily solved: I needed to apply ICC colour profiles. The XMP declared ISO 12647-2:2004, which was to be found at http://eci.org.

$ convert -profile ISOcoated_v2_eci.icc -profile eciRGB_v2.icc a.tif c.png
like image 168
clausvdb Avatar answered Nov 28 '22 03:11

clausvdb


When converting from a CMYK color space to an RGB color space, as you do when going from tiff to png, you have to convert the color spaces along with the image. Try:

convert -colorspace rgb a.tif a.png

I ran this locally and get a better result from this than from the command line in your question, but my color vision sucks, so I can't guarantee that this is what you were after. =] Hope it gets you on the right track, anyway.

like image 40
Sniggerfardimungus Avatar answered Nov 28 '22 05:11

Sniggerfardimungus