= 2.3.0, PECL imagick 3)Imagick::transparentPaintImage — Paints pixels transparent說明public Imagick::tra">
(PECL imagick 2 >= 2.3.0, PECL imagick 3)
Imagick::transparentPaintImage — Paints pixels transparent
$target,$alpha,$fuzz,$invertPaints pixels matching the target color transparent. 此方法在Imagick基于ImageMagick 6.3.8以上版本編譯時可用。
targetThe target color to paint
alpha透明級別:1.0 是完全不透明,0.0 是完全透明。
fuzzThe amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.
invert
If true paints any pixel that does not match the target color.
成功時返回 true。
示例 #1 Imagick::transparentPaintImage()
<?php
function transparentPaintImage($color, $alpha, $fuzz) {
$imagick = new \Imagick(realpath("images/BlueScreen.jpg"));
//Need to be in a format that supports transparency
$imagick->setimageformat('png');
$imagick->transparentPaintImage(
$color, $alpha, $fuzz * \Imagick::getQuantum(), false
);
//Not required, but helps tidy up left over pixels
$imagick->despeckleimage();
header("Content-Type: image/png");
echo $imagick->getImageBlob();
}
?>