HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Convolve image

← contrastStretchImage   cropImage →
Applies a custom convolution kernel to the image.

Example

function convolveImage($image_path, $bias, $convolve_matrix)
{
    $imagick = new \Imagick(realpath($image_path));
    //$edgeFindingKernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1,];
    $imagick->setImageBias($bias * \Imagick::getQuantum());
    $imagick->convolveImage($convolve_matrix);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}