note 112426 added to imagick.setimagecolorspace
| From: | kevin.a.florida | Date: | Sat, 15 Jun 2013 15:53:58 +0000 |
| Subject: | note 112426 added to imagick.setimagecolorspace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195231@lists.php.net to get a copy of this message | ||
I have a better solution for solving inverted colors on php 5.3.x than posted. All the other
solutions I found darkens the image or messes with the colors.
See below (note: my imagick object is $jpeg)
$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 20% 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();
//end convert to RGB=========================|
----
Server IP: 69.147.83.199
Probable Submitter: 173.45.211.130
----
Manual Page -- http://php.net/manual/en/imagick.setimagecolorspace.php
Edit -- https://master.php.net/note/edit/112426
Del: integrated -- https://master.php.net/note/delete/112426/integrated
Del: useless -- https://master.php.net/note/delete/112426/useless
Del: bad code -- https://master.php.net/note/delete/112426/bad+code
Del: spam -- https://master.php.net/note/delete/112426/spam
Del: non-english -- https://master.php.net/note/delete/112426/non-english
Del: in docs -- https://master.php.net/note/delete/112426/in+docs
Del: other reasons-- https://master.php.net/note/delete/112426
Reject -- https://master.php.net/note/reject/112426
Search -- https://master.php.net/manage/user-notes.php