PHP | Imagick trimImage() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 ?php // Create an Imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-9.png'); // Trim the image. $imagick->trimImage(0); // Output the image header("Content-Type: image/" . $imagick->getImageFormat()); echo $imagick; ?> Output: Related Articles: PHP | Imagick borderImage() FunctionPHP | Imagick addImage() Function Reference: https://www.php.net/manual/en/imagick.trimimage.php Comment More infoAdvertise with us Next Article PHP | Imagick stripImage() Function V vijay_raj Follow Improve Article Tags : Misc Web Technologies PHP Image-Processing PHP-function PHP-Imagick +2 More Practice Tags : Misc Similar Reads PHP | Gmagick trimimage() function The Gmagick::trimimage() function is an inbuilt function in PHP which is used to remove edges that are the background color from the image. Syntax: Gmagick Gmagick::trimimage( float $fuzz ) Parameters:This function accepts a single parameter $fuzz which holds the fuzz. Return Value: This function re 1 min read PHP | Imagick stripImage() Function The Imagick::stripImage() function is an inbuilt function in PHP which is used to strip all profiles and comments from an image. Syntax: bool Imagick::stripImage( void ) Parameters:This function doesnât accepts any parameter. Return Value: This function returns TRUE on success. Exceptions: This func 1 min read PHP | Imagick writeImage() Function The Imagick::writeImage() function is an inbuilt function in PHP which is used to write an image to the specified filename. This function saves the image file in the same folder where your PHP script is located. Syntax: bool Imagick::writeImage( string $filename = NULL ) Parameters: This function ac 1 min read PHP | Imagick resizeImage() Function The Imagick::resizeImage() function is an inbuilt function in PHP which is used to scale an image to the desired dimensions. Syntax: bool Imagick::resizeImage( int $columns, int $rows, int $filter, float $blur, bool $best_fit = false, bool $legacy = false ) Parameters: This function accepts six para 2 min read PHP | Imagick readImage() Function The Imagick::readImage() function is an inbuilt function in PHP which is used to read an image from filename. Syntax: bool Imagick::readImage( string $filename ) Parameters:This function accepts a single parameter $filename which holds the name of the file. It can also accept URL of the file. Return 1 min read PHP | Imagick removeImage() Function The Imagick::removeImage() function is an inbuilt function in PHP which is used to remove an image from the image list. This function removes the current image which is pointed by the cursor. Syntax: bool Imagick::removeImage( void ) Parameters: This function doesnât accepts any parameters. Return V 1 min read Like