HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue


← transformImage   transposeImage →
Paints pixels matching the target color transparent. This method is available if Imagick has been compiled against ImageMagick version 6.3.8 or newer.
function transparentPaintImage($color, $alpha, $fuzz, $inverse)
    $imagick = new \Imagick(realpath("images/BlueScreen.jpg"));

    //Need to be in a format that supports transparency

        $fuzz * \Imagick::getQuantum(),

    //Not required, but helps tidy up left over pixels
    $canvas = new Imagick();
    $canvas->compositeimage($imagick, \Imagick::COMPOSITE_ATOP, 0, 0);

    header("Content-Type: image/png");
    echo $canvas->getImageBlob();