Removes a region of an image and collapses the image to occupy the removed portion.
function chopImage($image_path, $startX, $startY, $width, $height)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->chopImage($width, $height, $startX, $startY);
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}