HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Extent image

← exportImagePixels   filter →
Comfortability method for setting image size. The method sets the image size and allows setting x,y coordinates where the new area begins. This method is available if Imagick has been compiled against ImageMagick version 6.3.1 or newer.

Example

function extentImage($image_path)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->setImageBackgroundColor('orange');
    $imagick->extentImage(
        $imagick->getImageWidth(),
        $imagick->getImageHeight(),
        -100,
        -100
    );

    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}