(No version information available, might only be in Git)
Imagick::transparentPaintImage — Paints pixels transparent
Paints pixels matching the target color transparent. Diese Funktion ist verfügbar, wenn Imagick gegen die ImageMagick-Version 6.3.8 oder höher kompiliert wurde.
targetThe target color to paint
alphaDie Stufe der Transparenz. 1.0 ist völlig undurchsichtig und 0.0 ist komplett transparent.
fuzzDie Menge an Ungenauigkeit. Wird dieser Wert z.B. auf 10 gesetzt, so werden die Farbe Rot sowohl bei Intensitäten von 100 als auch 102 als identisch betrachtet.
invert
If TRUE paints any pixel that does not match the target color.
Liefert TRUE bei Erfolg.
Beispiel #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();
}
?>