Color mismatch converting YCCK Jpeg to sRGB colorspace

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
chrisrose708
Posts: 2
Joined: 2014-11-07T10:01:46-07:00
Authentication code: 6789

Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by chrisrose708 »

Hey,

We're having an off-color issue when converting a YCCK JPEG to sRGB colorspace. The JPEG also has an embedded CMYK profile.
Here is an example image:
Image

The cloud area on the image is blue-ish (when viewed from a program like Gimp or MS Paint), but after converting it turns green-ish.

Here is the convert command we're running:
convert input.jpg -limit thread 1 -resize 1024.0x768.0 -quality 89 -colorspace sRGB -auto-orient -strip out.jpg

We found some useful metadata on the image using this online tool: http://regex.info/exif.cgi

According to this thread, http://www.imagemagick.com/discourse-se ... 2&p=116316), it sounds like ImageMagick 6.8.9-10 will support these sort of conversions now.

Any advice on this?

Thanks!
Chris
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by snibgo »

When a file contains a profile, it is unwise to ignore it. Better is to convert it to sRGB. Then you can ignore the profile, eg by stripping it:

Code: Select all

convert KW3Snub.jpg -profile sRGB.icc -strip r.png
This seems to work, in v6.8.9-5. Perhaps in 6.8.9-10 a "-colorspace sRGB" would work.
snibgo's IM pages: im.snibgo.com
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by dlemstra »

The YCCK color conversion was only added to the tiff reader in 6.8.9-10. I will try to see if I can also add it to the jpeg reader.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by dlemstra »

It turns out the color is green CMYK (85%, 0%, 31%, 0%) and it is already corrected by the jpeg library.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
chrisrose708
Posts: 2
Joined: 2014-11-07T10:01:46-07:00
Authentication code: 6789

Re: Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by chrisrose708 »

I don't think the original color is green CMYK. Here's a picture of the image viewed in GIMP:

Image

The top is the original image (blue-ish), and the bottom is the converted image after running the following convert command:
convert KW3Snub.jpg -colorspace sRGB -strip out.jpg

This is tested with ImageMagick 6.8.9-10.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by dlemstra »

The top is showing RGB instead of CMYK so I am not sure if you should trust the result. Fred checked the color in Photoshop and it was: CMYK (85%, 0%, 31%, 0%) which is 'greenish'.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Color mismatch converting YCCK Jpeg to sRGB colorspace

Post by fmw42 »

You can see the color by

Code: Select all

convert -size 100x100 xc:"CMYK (85%,0%,31%,0%)" swatch.png
This matches the second picture. But if you want better color representation from CMYK to sRGB, then use profiles rather than -colorspace.

Code: Select all

convert KW3Snub.jpg -profile /Users/fred/images/profiles/USWebCoatedSWOP.icc -profile /Users/fred/images/profiles/sRGB.icc KW3Snub_srgb.jpg
which now looks like the first image.
Post Reply