Skip to content
Related Articles

Related Articles

Improve Article
PHP | Imagick trimImage() Function
  • Last Updated : 26 Aug, 2019

The Imagick::trimImage() function is an inbuilt function in PHP which is used to remove the edges from the image.


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:


// Create an Imagick object
$imagick = new Imagick(
// Trim the image.
// Ouput the image
header("Content-Type: image/" . $imagick->getImageFormat());
echo $imagick;

trim image

Related Articles:


My Personal Notes arrow_drop_up
Recommended Articles
Page :