Imagick::transparentPaintImage

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

Imagick::transparentPaintImagePaints pixels transparent

Опис

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

Paints pixels matching the target color transparent. Цей метод доступний якщо Imagick був зібраний з версією ImageMagick 6.3.8 або новішою.

Параметри

target

The target color to paint

alpha

The level of transparency: 1.0 is fully opaque and 0.0 is fully transparent.

fuzz

The 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();
}

?>

add a note add a note

User Contributed Notes

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