function floodFillPaintImage($fillColor, $fuzz, $targetColor, $x, $y, $inverse, $channel) { $imagick = new \Imagick(realpath("images/BlueScreen.jpg")); // TODO - It should be possible to flood fill with a color that // is transparent, but currently it doesn't seem to work, presumably // because the image has no alpha channel; // $imagick->setImageAlphaChannel(Imagick::ALPHACHANNEL_ACTIVATE); $imagick->floodFillPaintImage( $fillColor, $fuzz * \Imagick::getQuantum(), $targetColor, $x, $y, $inverse, $channel ); header("Content-Type: image/jpeg"); echo $imagick->getImageBlob(); }