ImageMagick转换gif与透明度问题

时间:2011-08-02 21:35:22

标签: imagemagick transparency gif

我写了一个脚本,为我网站上的图片添加水印。一切都适用于png / jpg,但gif图像必须以更复杂的方式进行处理。我的剧本:

convert -splice x36 -gravity south -background white image.gif \
-coalesce -gravity SouthEast -geometry +0+0 -background white \
null: watermark-text.png -layers composite new-image.gif

95%的gif工作正常。但是有一些例子会带来错误。 关注此图片: image

普通猫。只有第一帧包含背景(在gimp中查看过的图层)。

enter image description here

这不是正常的猫。有什么建议吗?

1 个答案:

答案 0 :(得分:2)

问题是你的-splice是相对于gif框架的布局而不是整个图像的布局。首先执行-coalesce(订单很重要):

convert -coalesce -splice x36 -gravity south -background white image.gif \
-gravity SouthEast -geometry +0+0 -background white \
null: watermark-text.png -layers composite new-image.gif

有关详细信息,请参阅Simple Modifications of Animations中的“Examples of ImageMagick Usage”。