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!
Converted colors CMYK to SRGB too bright
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converted colors CMYK to SRGB too bright
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.
Perhaps you can provide sample images, before and after the process.
snibgo's IM pages: im.snibgo.com
Re: Converted colors CMYK to SRGB too bright
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!
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!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converted colors CMYK to SRGB too bright
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.paolob wrote:Version: ImageMagick 6.7.7-10
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