Imagemagick备忘

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

裁剪用-crop,jpg没问题,不过遇到gif就要注意了

例如下图:

裁剪只裁剪图片内容,不能消除背景的size,

convert image1.gif -crop 75x75+0+0 image2.gif

结果如下图片

解决办法使用+repage参数

convert image1.gif -crop 75x75+0+0 +repage image2.gif

75x75是结果的size,+0+0是图片在画布中间的偏移量,用了+repage会清空图片以外的空白

不过在jmagick的接口中没找到如何把+repage参数传递进去

/**

* 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只带了坐标信息,所以我现在切的gif图片size没办法去除所谓的“page geometry ”

这里说下不带偏移量的裁剪,效果很奇特,整个gif加载的时候会滚动在75x75的窗口中最后停下来

convert image1.gif -crop 75x75 +repage image2.gif

参考:http://www.cit.gu.edu.au/~anthony/graphics/imagick6/crop/#crop_repage

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航