Re: [GM-help] convert CMYK image to SRGB
Swiss army knife of image processing
Brought to you by:
bfriesen
From: Bob F. <bfr...@si...> - 2015-08-06 13:52:52
|
On Mon, 3 Aug 2015, James Bardin wrote: > > OK, this is what I thought. I'm already using this to normalize all images to the sRGB profile, but I can't get > some CMYK images into RGB format. After more testing, it seems my test images were confounding the problem. Some > other CMYK jpegs do convert nicely. > > After ProfileImage completes on these problem images, the img.colorspace is still CMYKColorspace, and there > appears to have been no CMS transform. Also, ProfileImage returns 1, and there's no exception in > Image.exception. I tested with a CMYK image with the profile stripped out, and I get the same behavior, so I > think I'll have to put in a manual colorpsace transform in there anyway to catch the case of a cmyk image > without a profile. > > ... > > after further testing, I'm finding that it may only be some (most?) YCCK images that are failing (GM only > identifies these as CMYK). The following image won't convert: > > http://sourceforge.net/p/libjpeg-turbo/patches/_discuss/thread/e9a20d03/acc4/attachment/image_ycck.jpeg > > But it's not *all* YCCK images, since I found one that does convert: > > https://issues.apache.org/jira/secure/attachment/12538847/test-YCCK.jpg I did not see your message until today. The image_ycck.jpeg file has no attached ICM profile but test-YCCK.jpg does. Also, image_ycck.jpeg has a black channel, but it is all zeros whereas test-YCCK.jpg has useful data in its black channel. The image_ycck.jpeg file requires that you first supply a ICM profile for the current colorspace and then supply the ICM profile for the target colorspace so ProfileImage() needs to be invoked twice whereas it only needs to be invoked once for test-YCCK.jpg. For one reason or another, colorspace transformations use the 'Transform' logging classification so use export MAGICK_DEBUG=Transform in the environment before running your program in order to get a log of ICM profile-related operations. Bob -- Bob Friesenhahn bfr...@si..., http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ |