Converted colors CMYK to SRGB too bright

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
paolob
Posts: 2
Joined: 2017-01-30T01:48:56-07:00
Authentication code: 1151

Converted colors CMYK to SRGB too bright

Post by paolob »

Hi,

I am having some troubles with color conversions. My website receives several images with different color profiles, so during the upload I need to convert them all to SRGB; my (former) web agency implemented "setImageColorSpace" but the colors of some images come out really too bright.

Here is our code:
$icc_rgb = file_get_contents(HOME_DIRECTORY . '/Software/htdocs/sRGB_v4_ICC_preference.icc');
$image = new Imagick($tmpPath);
$image->profileImage('icc', $icc_rgb);
$image->setImageColorSpace(Imagick::COLORSPACE_SRGB);
$image->writeImage($tmpPath);

I am not too familiar with PHP and cannot go back to my agency to ask them to fix this issue. Is there something wrong in the code or are the problems in the specific images that are uploaded?

Thank you for any help!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converted colors CMYK to SRGB too bright

Post by snibgo »

What version of IM are you using? I suppose you are doing this only for files that have embedded profiles? Why are you doing setImageColorSpace?

Perhaps you can provide sample images, before and after the process.
snibgo's IM pages: im.snibgo.com
paolob
Posts: 2
Joined: 2017-01-30T01:48:56-07:00
Authentication code: 1151

Re: Converted colors CMYK to SRGB too bright

Post by paolob »

Version: ImageMagick 6.7.7-10

My agency created this command for every uploaded image, so this should be working for both images with and without embedded profiles. I have attached the two versions of the yellow:

Original
https://www.dropbox.com/s/4g2xzb0bjhh1n ... L.png?dl=0

Converted:
https://www.dropbox.com/s/ymbqlb77qbw9t ... O.png?dl=0

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

Re: Converted colors CMYK to SRGB too bright

Post by snibgo »

paolob wrote:Version: ImageMagick 6.7.7-10
That's the major problem. In those days, IM was confused about RGB and sRGB. I suggest you upgrade to a more recent version. For compatibility, it may be best to stay on v6, rather than v7.

Maybe removing setImageColorSpace will cure the problem.

If an image doesn't have an embedded profile, then profileImage will assign a profile, which is no problem if the image is sRGB, but will be if it isn't.
snibgo's IM pages: im.snibgo.com
Post Reply