RGB to CMYK inverted colors (script PHP)
Posted: 2013-08-27T03:21:06-07:00
I am trying to convert a RGB photo in CMYK with a php script.
but inverted colors (O_O)
looking on google ..
http://stackoverflow.com/questions/4830 ... yk-inverts
is a bug or script wrong ?
SCRIPT PHP
HOSTING - PHPINFO
imagick module version 3.0.1
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.8.6-1 2013-06-24 Q16 http://www.imagemagick.org
but inverted colors (O_O)
looking on google ..
http://stackoverflow.com/questions/4830 ... yk-inverts
is a bug or script wrong ?
SCRIPT PHP
Code: Select all
$filePath = $percorso."/".$dir_letta."/".$file_letto;
$i = new Imagick($filePath);
$cs = $i->getImageColorspace();
if ($cs == Imagick::COLORSPACE_SRGB ||
$cs == Imagick::COLORSPACE_RGB){
print "Image is RGB<br/>\n";
?>
RGB Image:<br/>
<img src="<?php echo $filePath ?>"/>
<br/><br/>
<?php
$i->setImageColorspace(Imagick::COLORSPACE_CMYK);
$i->setImageFormat('jpeg');
$pos_punto = strripos($file_letto,"."); //ultima posizione del punto
$nomefile = substr($file_letto,0,$pos_punto); //nome file senza riferimento al tipo
echo "nomefile: ".$nomefile."<br>";
// write it to a temp file
$filePath = $percorso."/".$dir_letta."/".$nomefile."-pdf.jpg";
$i->writeImage($filePath);
} else {
print "Image is not RGB<br/>\n";
}
if ($cs == Imagick::COLORSPACE_CMYK) {
print "Image is CMYK<br/>\n";
}
?>
CMYK Image:<br/>
<img src="<?php echo $filePath ?>"/>
<?php
$i->clear();
$i->destroy();
$i = null;
HOSTING - PHPINFO
imagick module version 3.0.1
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.8.6-1 2013-06-24 Q16 http://www.imagemagick.org