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