I am trying to remove transparent areas of an image with php using imagick.
Image Magick provides the trim
method:
Imagick::trimImage
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.
How do I set the color which Imagick may trim?
The following script sets the background color to grey. However trim removes the blue background color as you can see below.
$im = new Imagick( "1.png" );
// Set background color to grey
$im->setImageBackgroundColor( new ImagickPixel( "rgb(213,213,213)" ) );
$im->trimImage( 0 );
$im->writeImage('2.png');
Is there any way to limit the trim colors?
imagick module version => 2.1.1-rc1