PHP | Imagick trimImage() Function
The Imagick::trimImage() function is an inbuilt function in PHP which is used to remove the edges from the image.
Syntax:
bool Imagick::trimImage( $fuzz )
Parameters: This function accepts single parameter $fuzz. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. This parameter represents the variation on the quantum range.
Return Value: This function returns True on success.
Errors/Exceptions: This function throws ImagickException on error.
Below program illustrates the Imagick::trimImage() function in PHP:
Program:
?php // Create an Imagick object $imagick = new Imagick( // Trim the image. $imagick->trimImage(0); // Ouput the image header("Content-Type: image/" . $imagick->getImageFormat()); echo $imagick; ?> |
Output:

Related Articles:
Reference: http://php.net/manual/en/imagick.trimimage.php
Recommended Posts:
- PHP | imagick getImageDispose() Function
- PHP | Imagick getImageRenderingIntent() Function
- PHP | Imagick getImageMimeType() Function
- PHP | Imagick getImageMatte() Function
- PHP | Imagick setImageMatte() Function
- PHP | Imagick autoLevelImage() Function
- PHP | Imagick appendImages() Function
- PHP | Imagick getImageChannelDepth() Function
- PHP | Imagick setImageOpacity() Function
- PHP | Imagick getImageScene() Function
- PHP | Imagick getQuantumRange() Function
- PHP | Imagick getQuantumDepth() Function
- PHP | Imagick setImageRenderingIntent() Function
- PHP | Imagick setImageChannelDepth() Function
- PHP | Imagick getImageBluePrimary() 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.



