Cropped with -crop, JPG is no problem, but I have to pay attention to GIF.
For example, the following figure:
Crop only cropping the picture content, can not eliminate the background size, convert image1.gif -crop 75x75 0 0 image2.gif
The result is as follows
Solution to use repAge parameters
Convert image1.gif -crop 75x75 0 0 reprage image2.gif
75x75 is the result of the result, 0 0 is the offset in the middle of the canvas, with repAge will empty the blank outside the picture
However, I didn't find how to pass the Repage parameters in the interface of Jmagick.
/ ** * Creates a new image that is a subregion of the original * * @param chopInfo the subimage * @return a subimage of the original * @exception MagickException on error * / public native MagickImage cropImage (Rectangle chopInfo) throws MagickException.;
Rectangle only took coordinate information, so I have now cut GIF picture size can't remove the so-called "page geometry"
Here, there is a cropping cut, the effect is very strange, and the entire GIF is loaded, it will scroll in the 75x75 window.
Convert image1.gif -crop 75x75 reprage image2.gif
Reference: http://www.cit.gu.edu.au/~anthony/graphics/imagick6/crop/#crop_repage