HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

get color value

← getColorCount   getColorValueQuantum →
Retrieves the value of the color channel specified, as a floating-point number between 0 and 1.
Alpha value is 0.75

Red value is 0.9
Green value is 0.2
Blue value is 0.2

Cyan value is 0.9
Magenta value is 0.2
Yellow value is 0.2
Black value is 0

Example

$color = new \ImagickPixel('rgba(90%, 20%, 20%, 0.75)');
$output =  "Alpha value is " . $color->getColorValue(\Imagick::COLOR_ALPHA) . "<br/>";
$output .=  "" . "<br/>";
$output .=  "Red value is " . $color->getColorValue(\Imagick::COLOR_RED) . "<br/>";
$output .=  "Green value is " . $color->getColorValue(\Imagick::COLOR_GREEN) . "<br/>";
$output .=  "Blue value is " . $color->getColorValue(\Imagick::COLOR_BLUE) . "<br/>";
$output .=  "" . "<br/>";
$output .=  "Cyan value is " . $color->getColorValue(\Imagick::COLOR_CYAN) . "<br/>";
$output .=  "Magenta value is " . $color->getColorValue(\Imagick::COLOR_MAGENTA) . "<br/>";
$output .=  "Yellow value is " . $color->getColorValue(\Imagick::COLOR_YELLOW) . "<br/>";
$output .=  "Black value is " . $color->getColorValue(\Imagick::COLOR_BLACK) . "<br/>";