嵌套的ImageMagick命令

时间:2016-02-20 00:55:58

标签: imagemagick imagemagick-convert

如何将以下命令附加到ImageMagick的单个命令中?

convert -size 1024x1024 xc:none -draw "roundrectangle 0,0,1024,1024,40,40" png:- | convert AppStore.png -matte - -compose DstIn -composite Logo@3x.png
convert -resize 50% Logo@3x.png Logo@3x.png
convert -resize 50% Logo@3x.png Logo@2x.png
convert -resize 50% Logo@2x.png Logo.png

1 个答案:

答案 0 :(得分:1)

我想你可能想要这样的东西:

convert AppStore.png -matte                                                 \
   \( -size 1024x1024 xc:none -draw "roundrectangle 0,0,1024,1024,40,40" \) \
   -compose DstIn -composite -resize 50% -write MPR:basic                   \
   \( MPR:basic -resize 50% -write Logo@2x.png +delete \)                   \
   \( MPR:basic -resize 25% -write Logo.png    +delete \)                   \
   Logo@3x.png

或者如果你想避免使用MPR(存储器程序寄存器):

convert AppStore.png -matte                                                 \
   \( -size 1024x1024 xc:none -draw "roundrectangle 0,0,1024,1024,40,40" \) \
   -compose DstIn -composite -resize 50%                                    \
   \( +clone -resize 50% -write Logo@2x.png +delete \)                      \
   \( +clone -resize 25% -write Logo.png    +delete \)                      \
   Logo@3x.png