A convenience method for setting crop size and the image geometry from strings. Available since 6.2.9
Image
A convenience method for setting crop size and the image geometry from strings. Available since 6.2.9
Parameters
cropstringA crop geometry string. This geometry defines a subregion of the image to crop.
geometrystringAn image geometry string. This geometry defines the final size of the image.
function transformimage($imagePath)
{
    $imagick = new \Imagick(realpath($imagePath));
    $newImage = $imagick->transformimage("400x600", "200x300");
    header("Content-Type: image/jpg");
    echo $newImage->getImageBlob();
}