imagick icon indicating copy to clipboard operation
imagick copied to clipboard

`ImagickPixel::clear()` is not working

Open rahgurung opened this issue 5 years ago • 2 comments

rahgurung avatar Dec 26 '19 07:12 rahgurung

Could you do me a favour and give some example PHP code that you expect to work?

Maybe something similar to the code in https://github.com/Imagick/imagick/blob/master/tests/269_ImagickPixel_setColorFromPixel_basic.phpt

Danack avatar Dec 26 '19 13:12 Danack

Code:

<?php
// Create a new imagickPixel object
$imagickPixel = new ImagickPixel(); 

// Set the color
$imagickPixel->setColor('#38d9d3');

// Get the color
$color = $imagickPixel->getColor();

// Print the color
print("<pre>".print_r($color,true)."</pre>");

$imagickPixel->clear();

// Get the color
$color = $imagickPixel->getColor();

// Print the color
print("<pre>".print_r($color,true)."</pre>");
?>

Output:

Array
(
    [r] => 56
    [g] => 217
    [b] => 211
    [a] => 1
)
Array
(
    [r] => 56
    [g] => 217
    [b] => 211
    [a] => 1
)

Expected:

Array
(
    [r] => 56
    [g] => 217
    [b] => 211
    [a] => 1
)
Array
(
    [r] => 0
    [g] => 0
    [b] => 0
    [a] => 1
)

rahgurung avatar Dec 26 '19 15:12 rahgurung