HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Crop image

← convolveImage   deskewImage →
Extracts a region of the image.

Example

function cropImage($image_path, $startX, $startY, $width, $height)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->cropImage($width, $height, $startX, $startY);
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}