Page 1 of 1

CMYK to RGB

Posted: 2010-04-20T08:59:54-07:00
by BeckhamStZ
Hello guys. I'm newbie with Imagemagick.
I want to convert CMYK color to RGB color, but many algorithms which I found doesnt work correctly.
( For example CMYK 0 100 100 0 convert to RGB 255 0 0 but in Adobe Photoshop the RGB Value is not this and also the G and B channels aren't zero )
Is there a way to use Imagemagick to get RGB value of Cmyk color?

Re: CMYK to RGB

Posted: 2010-04-20T09:27:27-07:00
by fmw42
in command line

convert -size 1x1 xc:"cmyk(100,50,25,10)" -colorspace RGB txt:

or

use the color converter at http://www.imagemagick.org/script/color.php

Note: for more exact conversion of a CMYK image to RGB you need to use profiles. see http://www.imagemagick.org/Usage/formats/#profiles

Re: CMYK to RGB

Posted: 2010-04-30T15:17:21-07:00
by BeckhamStZ
I want to use it in php to create text with rgb color from cmyk color. I try with profiles in command line and everything is ok but now in php is not.

Code: Select all

$im = new Imagick();

$im->newImage( 100, 100, new ImagickPixel('cmyk(0,100,100,0)'), 'jpeg');
$im->setImageColorSpace(Imagick::COLORSPACE_CMYK);

header('Content-Type: image/jpeg');
echo $im;
this code make a picture not in cmyk ( its in RGB ) and when I get ImagePixel from x=5 y=5 for example his value is rgb(0,100,100)
Where is the problem ?

Re: CMYK to RGB

Posted: 2010-04-30T16:11:01-07:00
by fmw42
Don't know much about Imagick, but try swapping the order of these two lines

Code: Select all

$im->newImage( 100, 100, new ImagickPixel('cmyk(0,100,100,0)'), 'jpeg');
$im->setImageColorSpace(Imagick::COLORSPACE_CMYK);
Do you know if IMagick allows colors to be specified in CMYK?

Re: CMYK to RGB

Posted: 2010-05-01T00:40:22-07:00
by BeckhamStZ
When swap two lines the result is this ->
Can not process empty Imagick object.

when I add a profiles and call getImageProfiles the returned array is empty.

Re: CMYK to RGB

Posted: 2010-10-25T04:23:32-07:00
by cyklop
Did you found a solution?