HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

Get color

← destroy   getColorQuantum →
Returns the color described by the ImagickPixel object, as an array. If the color has an opacity channel set, this is provided as a fourth value in the list.
Create an ImagickPixel with the predefined color 'brown' and set the color to have an alpha of 25%

Standard values

r : 165
g : 42
b : 42
a : 0

Normalized values

r : 0.6470588235
g : 0.1647058824
b : 0.1647058824
a : 0.25

Example

$color = new \ImagickPixel('brown');
$color->setColorValue(\Imagick::COLOR_ALPHA, 0.25);
$output .= "<h4>Standard values</h4>";
foreach ($color->getColor() as $key => $value) {
    $output .= "$key : $value <br/>";
}
$output .= "<br/>";
$output .= "<h4>Normalized values</h4>";
foreach ($color->getColor(true) as $key => $value) {
    $output .= "$key : $value <br/>";
}