Imagick::transparentPaintImage

(No version information available, might only be in Git)

Imagick::transparentPaintImagePaints pixels transparent

Opis

Imagick::transparentPaintImage ( mixed $target , float $alpha , float $fuzz , bool $invert ) : bool

Paints pixels matching the target color transparent. Ta metoda jest dostępna, jeśli rozszerzenie Imagick zostało skompilowane z ImageMagick w wersji 6.3.8 lub nowszej.

Parametry

target

The target color to paint

alpha

Poziom przezroczystości: 1.0 - w pełni nieprzezroczysty, 0.0 - w pełni przezroczysty.

fuzz

Ilość puchu. Przykładowo, ustaw puch na 10, a kolor czerwony o intensywności 100 i 102, będzie rozpoznawany jako ten sam kolor.

invert

If TRUE paints any pixel that does not match the target color.

Zwracane wartości

Zwraca TRUE w przypadku sukcesu.

Przykłady

Przykład #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();
}

?>

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top