PHP | Imagick chopImage() Function
The Imagick::chopImage() function is an inbuilt function in PHP which is used to remove the region of an image and trim it. This function accepts the dimension of image and chops the area and the dimension from where the image is to be trim.
Syntax:
bool Imagick::chopImage( $width, $height, $x, $y )
Parameters: This function accepts four parameters as mentioned above and described below:
- $width: This parameter stores the width of the chopped area.
- $height: This parameter stores the height of the chopped area.
- $x: This parameter stores the x-origin of the chopped area.
- $y: This parameter stores the y-origin of the chopped area.
Return Value: This function returns True on success.
Original Image:

Below program illustrates the Imagick::chopImage() function in PHP:
Program:
<?php // require_once('path/vendor/autoload.php'); // Create a new Imagick Object $image = new Imagick( // chopImage function $image->chopImage(40, 35, 1, 2); header('Content-type: image/png'); // Display the output image echo $image; ?> |
Output:

Related Articles:
Reference: http://php.net/manual/en/imagick.chopimage.php
Recommended Posts:
- PHP | Gmagick chopimage() Function
- PHP | Imagick listRegistry() Function
- PHP | Imagick labelImage() Function
- PHP | Imagick setRegistry() Function
- PHP | Imagick paintOpaqueImage() Function
- PHP | Imagick morphology() Function
- PHP | Imagick edgeImage() Function
- PHP | Imagick clampImage() Function
- PHP | Imagick getImageWhitePoint() Function
- PHP | Imagick colorMatrixImage() Function
- PHP | Imagick haldClutImage() Function
- PHP | Imagick hasPreviousImage() Function
- PHP | Imagick compositeImage() Function
- PHP | Imagick resampleImage() Function
- PHP | Imagick opaquePaintImage() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




