HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

Imagick::selectiveBlurImage

← segmentImage   separateImageChannel →
Selectively blur an image within a contrast threshold. It is similar to the unsharpen mask that sharpens everything with contrast above a certain threshold.
function selectiveBlurImage($image_path, $radius, $sigma, $threshold, $channel)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->selectiveBlurImage(
        $radius,
        $sigma,
        $threshold * \Imagick::getQuantum(),
        $channel
    );
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}