| Server IP : 162.214.74.102 / Your IP : 216.73.216.192 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /opt/cpanel/ea-php71/root/usr/share/tests/pecl/imagick/tests/ |
Upload File : |
--TEST--
Imagick::setImageAlpha
--SKIPIF--
<?php
$imageMagickRequiredVersion=0x700;
require_once(dirname(__FILE__) . '/skipif.inc');
?>
--FILE--
<?php
$imagick = new Imagick();
$imagick->newPseudoImage(256, 256, 'xc:purple');
$imagick->setImageAlpha(0.5);
$imagick->setImageFormat('png');
$imagick->writeImage("./setAlphaTest.png");
$pixelTypes = array(
Imagick::PIXEL_CHAR => array(128, 0, 128, 128),
Imagick::PIXEL_FLOAT => array(0.50196081399918, 0, 0.50196081399918, 0.5),
Imagick::PIXEL_DOUBLE => array(0.50196078431373, 0, 0.50196078431373, 0.5),
Imagick::PIXEL_SHORT => array(32896, 0, 32896, 32768),
);
foreach ($pixelTypes as $pixelType => $expectedValues) {
$pixels = $imagick->exportImagePixels(0, 0, 1, 1, "RGBA", $pixelType);
for ($i=0; $i<4; $i++) {
$actual = $pixels[$i];
$expected = $expectedValues[$i];
if (abs($actual - $expected) > 0.0000001) {
echo "Pixel values appear incorrect for pixelType $pixelType:";
var_dump($pixels);
break;
}
}
}
echo "Ok";
?>
--EXPECTF--
Ok