Good, so this is a difficult problem. I had the same problem and it took me days to solve this problem. You need negateImage (), please see my example and make sure that you only do this for php 5.3.x, as this problem is unique to this php vs.
$range = $jpeg->getQuantumRange(); $php_vs_arr = preg_split("/\./", phpversion()); $php_vs = $php_vs_arr[0] . '.' . $php_vs_arr[1]; if ($jpeg->getImageColorspace() == Imagick::COLORSPACE_CMYK) { //make sure cmyk color-space is set correctly $jpeg->setImageColorspace(12); // then we add an RGB profile $icc_rgb = file_get_contents(FRAMEWORK_PATH . DS . 'color' . DS . 'AdobeRGB1998.icc'); $jpeg->profileImage('icc', $icc_rgb); unset($icc_rgb); //set color space to rgb $jpeg->setImageColorspace(13); //fix gamma, hue, saturation, brightness if($php_vs < 5.3) { //ADJUST GAMMA BY 2.0 for 5.2.x $jpeg->levelImage(0, 2.0, $range['quantumRangeString']); } else { //php 5.3 hack FOR INVERTED COLORS $jpeg->negateImage(false, Imagick::CHANNEL_ALL); } } $jpeg->stripImage();
Note: my Imagick object is obviously $ jpeg
In addition, you will need to download the AdobeRGB1998.icc profile from the Adobe website, just search on Google.
I hope this helps, please mark this as the correct answer, as many people have problems with this.
source share