PHP 8.5.0 Beta 1 available for testing

Voting

: max(five, six)?
(Example: nine)

The Note You're Voting On

kevin.a.florida
12 years ago
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=========================|

<< Back to user notes page

To Top