Problem with converting a CMYK image to RGB

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gorszy
Posts: 2
Joined: 2016-02-18T06:16:42-07:00
Authentication code: 1151

Problem with converting a CMYK image to RGB

Post by gorszy »

I have a problem with a CMYK image which I can't properly convert into an RGB image. The original image looks OK in the Windows image viewer or in other viewers, but not in Firefox or Chrome - the skintone is reddish, the whole image looks oversatured.

The image is available here:
//removed
It has an embedded profile and I'm using the sRGB_v4_ICC_preference.icc to convert it to RGB by running:

Code: Select all

convert cmyk.jpg -profile sRGB_ICC_v4_appearance_beta_displayclass.icc -colorspace sRGB srgb.jpg
The result looks like this - original on the left, converted on the right - looks similar to how the browsers display the original image:
//removed

I've tried also:

Code: Select all

convert cmyk.jpg -profile sRGB_ICC_v4_appearance_beta_displayclass.icc srgb.jpg
the image will still look bad in browsers (and identify says it's still CMYK).

I'm using ImageMagick 6.9.1-3 Q16 i686 2015-07-01 on Windows 10 64-bit on 32-bit Cygwin.
Last edited by gorszy on 2016-02-25T05:20:06-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with converting a CMYK image to RGB

Post by snibgo »

gorszy wrote:It has an embedded profile ...
cmyk.jpg doesn't have an embedded profile. Try "identify -verbose". (Or, if it does, IM can't see it.)

So you can convert it to sRGB either with a simple "-colorspace sRGB" or by first assigning a CMYK profile, then converting to a sRGB profile.

You should use one or other method. Your command confuses the two methods.

Code: Select all

convert cmyk.jpg -colorspace sRGB x2.jpg

Code: Select all

convert cmyk.jpg -profile USWebUncoated.icc -profile sRGB_v4_ICC_preference.icc x.jpg
The simple method gives a reddish cast to the skin. That is probably what web browsers do (because there is no embedded profile).
snibgo's IM pages: im.snibgo.com
gorszy
Posts: 2
Joined: 2016-02-18T06:16:42-07:00
Authentication code: 1151

Re: Problem with converting a CMYK image to RGB

Post by gorszy »

Thanks for response. I didn't realize some of my CMYK samples haven't had an ICC profile - i've seen identify printing several profiles, but now I see none of them was ICC (the sample from the first post was even worse, because I couldn't post the whole image and cropping it removed all other profiles as well).

So I assume I should use:

Code: Select all

convert cmyk.jpg -profile sRGB_ICC_v4.icc srgb.jpg
for CMYK images with an embedded profile and use a stock CMYK profile:

Code: Select all

convert cmyk.jpg -profile ISO_CMYK.icc -profile sRGB_ICC_v4.icc srgb.jpg
for CMYK images without an embedded profile (worked quite well with the sample from the first post, definitely better than just -colorspace sRGB)?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem with converting a CMYK image to RGB

Post by snibgo »

Yes, that's correct. When an image has an embedded profile, you need just one "-profile" to convert to sRGB. When it has no embedded profile, the first "-profile" assigns a profile and the second converts the image.

In this example, the two-stage profile conversion gives the more pleasing result, but of course we are guessing at the CMYK profile that was used to encode the image. Some other profile might be more accurate.
snibgo's IM pages: im.snibgo.com
Post Reply