问题
I've some problem with php and imagick, i want to convert some image from rgb system to cmyk, but i've only black/or non background nothing else.
$icc_cmyk = file_get_contents('USWebUncoated.icc');
$img->profileImage('icc', $icc_cmyk);
$img->setImageColorspace(12);
if ($php_vs < 5.3) {
//ADJUST GAMMA BY 20% for 5.2.x
$img->levelImage(0, 2.0, $range['quantumRangeString']);
} else {
//php 5.3 hack FOR INVERTED COLORS
$img->negateImage(false, Imagick::CHANNEL_ALL);
}
$img->stripImage();
//$img->setImageColorspace(Imagick::COLORSPACE_CMYK);
$img->writeImage('cmyk.png');
回答1:
All right I've some resolve but i don't know it's working, if someone can taste it i will be very greatfull :)
$img->setImageColorspace(13);
$icc_rgb = file_get_contents('AdobeRGB1998.icc');
$img->profileImage('icc', $icc_rgb);
unset($icc_rgb);
$icc_cmyk = file_get_contents('USWebUncoated.icc');
$img->profileImage('icc', $icc_cmyk);
$img->setImageColorspace(12);
unset($icc_cmyk);
$img->setimagecolorspace(Imagick::COLORSPACE_CMYK);
$img->stripImage();
$img->writeImage('cmyk.png');
回答2:
Use this working RGB to CMYK Image with Php
$icc_cmyk = file_get_contents('images/CoatedFOGRA27.icc');// Your Cmyk ICC Profile
$img->profileImage('icc', $icc_cmyk);
$img->transformimagecolorspace(Imagick::COLORSPACE_CMYK);
$img->writeImage('cmyk.jpg');// Save as jpg or jpeg`
来源:https://stackoverflow.com/questions/17932567/image-from-rgb-to-cmyk-in-php