GoLang Imagick::trimImage

request it (251)
GoLang replacement for PHP's Imagick::trimImage [edit | history]

Do you know a GoLang replacement for PHP's Imagick::trimImage? Write it!

PHP Imagick::trimImage

PHP original manual for Imagick::trimImage [ show | php.net ]


(PECL imagick 2.0.0)

Imagick::trimImageRemove edges from the image


bool Imagick::trimImage ( float $fuzz )

Remove edges that are the background color from the image. This method is available if Imagick has been compiled against ImageMagick version 6.2.9 or newer.



By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. 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 Values

Returns TRUE on success.


Throws ImagickException on error.


Example #1 Using Imagick::trimImage():

Trim an image, then display to the browser.

/* Create the object and read the image in */
$im = new Imagick("image.jpg");

/* Trim the image. */

/* Ouput the image */
header("Content-Type: image/" $im->getImageFormat());

See Also