Page 1 of 1

Converted colors CMYK to SRGB too bright

Posted: 2017-01-30T02:03:38-07:00
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!

Re: Converted colors CMYK to SRGB too bright

Posted: 2017-01-30T02:35:12-07:00
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.

Re: Converted colors CMYK to SRGB too bright

Posted: 2017-01-30T03:28:28-07:00
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!

Re: Converted colors CMYK to SRGB too bright

Posted: 2017-01-30T03:37:14-07:00
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.