开发者

Wrong colours when converting TIFF image to PNG in ImageMagick

开发者 https://www.devze.com 2023-01-08 18:51 出处:网络
I\'m working on a PHP script that automatically converts TIFF images to PNG files. For that purpose, I use 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 probl开发者_运维技巧em, 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!


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消