使用Imagemagick将图像作为背景添加到先前操作的图像

时间:2014-01-31 15:44:26

标签: image imagemagick image-manipulation imagemagick-convert

我正在编写一个脚本:

  • 作物
  • 添加背景图片

到一系列约400个透明的PNG。我想尽可能快地运行。

目前我已将它作为两个单独的命令:

convert $input.png -scale $scale% -gravity Center -crop 640x640+0+0 +repage $output.png
composite -gravity center $output.png $background $output.png

有没有办法将其减少为单个命令?我一直在查看-composite的文档但我看不到添加图像作为背景之后执行其他操作的方法。

有什么想法吗?感谢

1 个答案:

答案 0 :(得分:0)

为什么不使用&& amp;两个命令之间?当furst退出时没有错误,第二个命令将被执行......应该工作......