HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelTutorial Source codeReport an issue
Category
Example

Magnify image

← linearStretchImage   meanShiftImage →
Is a convenience method that scales an image proportionally to twice its original size.
The image may not look twice the size, as the size of it is constrained by the page layout.
function magnifyImage($image_path /*, string $magnify_type*/)
{
    $imagick = new \Imagick(realpath($image_path));

    // This doesn't appear to work
//    if ($magnify_type !== "default") {
//        $imagick->setOption("magnify:method", $magnify_type);
//    }

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