HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

get color as string

← getColorQuantum   getColorCount →
Returns the color of the ImagickPixel object as a string.
Note - currently it is not possible to get the alpha of the color through this method.
Create an ImagickPixel with the predefined color 'brown' and output the result of `getColorAsString`.
srgb(165,42,42)
$output = "Create an ImagickPixel with the predefined color 'brown' and output the result of `getColorAsString`. <br/>";
$color = new \ImagickPixel('brown');
$color->setColorValue(\Imagick::COLOR_ALPHA, 64 / 256.0);
$output .= $color->getColorAsString();
return $output;