How to handle invalid color profiles
Posted: 2019-08-01T11:22:53-07:00
The image in a previous forum post has RGB pixels but a CMYK color profile:
http://www.imagemagick.org/discourse-se ... hp?t=30217
When I attempt to convert this file using the following command, the output file has heavily distorted colors, presumably because ImageMagick is attempting to use the CMYK profile, even though the image is RGB:
However, if I strip the CMYK profile (e.g., using -strip), I get a reasonable result:
From the same forum post linked to above, it looks like ImageMagick used to output the following error when a profile did not match the pixel format:
Without this error, I'm not sure how I can check for compatibility between the pixel format and the embedded profile, in an automated and robust way. Is there some other way to check for compatibility, or should this error be reintroduced?
I'm using ImageMagick 7.0.8-25 Q16 x86_64 2019-02-01.
http://www.imagemagick.org/discourse-se ... hp?t=30217
When I attempt to convert this file using the following command, the output file has heavily distorted colors, presumably because ImageMagick is attempting to use the CMYK profile, even though the image is RGB:
Code: Select all
convert fXBUFte.jpg -profile sRGB2014.icc out.jpg
Code: Select all
convert fXBUFte.jpg -strip -profile sRGB2014.icc out.jpg
Code: Select all
color profile operates on another colorspace `icc' @ error/profile.c/ProfileImage/1047
I'm using ImageMagick 7.0.8-25 Q16 x86_64 2019-02-01.