Page 1 of 1
Command line CMYK <=> RGB works, Imagick does not.
Posted: 2008-04-04T12:28:59-07:00
by NitroPye
I am having some issues getting CMYK <=> RGB conversion working with Imagick. I am able to do this properly on the command line but when I do it thru Imagick I get improper colors.
Here is the convert command I use from the command line client:
Code: Select all
convert Test_CMYK.psd -profile ColorArt85290.icc -profile sRGB.icc -colorspace RGB Test_RGB.png
This works perfectly and colors are okay. But when I do this colors are messed up (as though I'm doing the CMYK conversion incorrectly)
Code: Select all
$img = new Imagick("File.psd");
$img->setImageFormat('jpeg');
$img->profileImage('ColorArt85290', 'ColorArt85290.icc');
$img->profileImage('sRGB', 'sRGB.icc');
$img->setImageColorspace(imagick::COLORSPACE_RGB);
header( "Content-Type: image/jpeg" );
echo $img;
Has anyone successfully used Imagick with CMYK images?
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2008-04-07T06:16:33-07:00
by mkoppanen
On the first example you get png output and on the second one there is jpeg output. I don't know if that makes a difference. Can you post the images and profiles so that I can test?
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2008-04-07T07:05:44-07:00
by NitroPye
Using png for the Imagick example doesn't work either. I tried jpeg, because I wanted to set the image format to something that could handle CMYK in memory (to rule that out)
Here are the color profiles and example images I am using. I choose this example image because it has a ton of green making it very easy to tell when CMYK -> RGB goes wrong:
http://cole.nitroy.com/Files/Temp/IM_Test/
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2008-04-07T08:19:55-07:00
by mkoppanen
using ImageMagick 6.4.0 03/31/08 Q16
http://www.imagemagick.org exactly the same results from command line and Imagick. The green colored image.
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2008-04-07T10:25:02-07:00
by NitroPye
Against the source image? On my end I get two different green images, one dark (correct), one very bright. I would love for this to be a simple goof up on my end as this is a problem I will eventually need to work around no matter what.
Here are the exact files I used:
And to rule out any version discrepancies here are the versions I am running:
ImageMagick version
Code: Select all
coleman@babylon IM_Test $ convert --version
Version: ImageMagick 6.4.0 04/04/08 Q16 http://www.imagemagick.org
Imagick version
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2008-04-15T09:42:57-07:00
by NitroPye
*bump*
Anyone able to do a CMYK to RGB conversion with Imagick?
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2009-02-17T09:29:51-07:00
by NitroPye
Many versions of ImageMagick and Imagick later I am still coming up against this issue.
Here is the exact code I am using with PHP:
Code: Select all
<?php
$img = new Imagick("Test_CMYK.psd");
$img->setImageFormat('png');
$icc = file_get_contents('ColorArt85290.icc');
$img->profileImage('ColorArt85290', $icc);
$icc = file_get_contents('sRGB.icc');
$img->profileImage('sRGB', $icc);
$img->setImageColorspace(imagick::COLORSPACE_RGB);
header( "Content-Type: image/png" );
echo $img;
?>
And here is the exact code I am using via the command line:
Code: Select all
convert Test_CMYK.psd -profile ColorArt85290.icc -profile sRGB.icc -colorspace RGB Test_RGB.png
The exact files I am using from ICC profiles to Image files are located here:
http://cole.nitroy.com/Files/Temp/Test_IM.zip
I even changed my delegates.xml file and altered all ghostscript delegates as mentioned in this article:
http://john.ukmn.com/2007/06/19/imagema ... yk-to-rgb/
ImageMagick version 6.4.9-1
Imagick version 2.2.2RC4
Running on an Intel Mac as a 32bit binary on OS X 10.5.6 & 10.5.2
I have a feeling it has to do with the order of how I am doing things with Imagick in PHP that is the issue. The image created by the PHP Imagick is light washed out green while the original has dark deep greens. I've tried just about everything, has
anyone at all been able to take a CYMK image in and spit out proper RGB out???
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2009-02-17T15:26:27-07:00
by mkoppanen
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2009-02-17T16:57:42-07:00
by NitroPye
Yep thats exactly it!
Were you able to get that output via Imagick?
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2009-02-20T13:30:58-07:00
by mkoppanen
NitroPye wrote:Yep thats exactly it!
Were you able to get that output via Imagick?
Yes, I was. Here is the script I used:
Code: Select all
<?php
$img = new Imagick("Test_CMYK.psd");
$icc = file_get_contents('sRGB.icc');
$img->profileImage('ICC', $icc);
$img->setImageColorspace(imagick::COLORSPACE_RGB);
$img->setImageFormat('png');
header( "Content-Type: image/png" );
echo $img;
I was able to reproduce the original problem you had with following convert command:
Code: Select all
convert Test_CMYK.psd -profile sRGB.icc -profile ColorArt85290.icc -colorspace RGB Test_RGB.png
Looks like the latter profile overrides the first one.
Re: Command line CMYK <=> RGB works, Imagick does not.
Posted: 2009-02-20T15:15:32-07:00
by NitroPye
Whooha! That was it!
I don't know how in all of my mucking about I didn't end up with using just the one profile.
Thanks a ton!
I owe you a pint!