ImagickPixel::getColorAsString

(PECL imagick 2.1.0)
Returns the color as a string
string ImagickPixel::getColorAsString ( void )

Returns the color of the ImagickPixel object as a string.

Returns:

Returns the color of the ImagickPixel object as a string.

Notes:
Alpha not returned

This function does not return the alpha value of the color in the string.

Examples:
Basic Imagick::getColorAsString() usage
1
2
3
4
5
6
7
8
9
10
11
<?php
 
//Create an ImagickPixel with the predefined color 'brown'
$color new ImagickPixel('brown');
 
$color->setColorValue(Imagick::COLOR_ALPHA, 64 / 256.0);
 
$colorInfo $color->getColorAsString();
 
print_r($colorInfo);
?>

The above example will output:

rgb(165,42,42)
doc_php
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.