Removes a region of an image and collapses the image to occupy the removed portion.
Image
Start X
Start Y
Width
Height
Removes a region of an image and collapses the image to occupy the removed portion.
Parameters
widthintWidth of the chopped area
heightintHeight of the chopped area
xintX origo of the chopped area
yintY origo of the chopped area
function chopImage($imagePath, $startX, $startY, $width, $height)
{
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->chopImage($width, $height, $startX, $startY);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}