你能帮我去掉 imagemagick convert 命令中的中间输出吗?

Can you help me get rid of an intermediary output in my imagemagick convert commands?

我在 bash 中有以下 convert 命令。

    convert "$WALLPAPER1" -resize "${H[0]}"x"${V[0]}"^ -gravity center -crop "${H[0]}"x"${V[0]}"+0+0 "$WALLPAPERS/.temp1.jpg"
    convert "$WALLPAPER2" -resize "${H[1]}"x"${V[1]}"^ -gravity center -crop "${H[1]}"x"${V[1]}"+0+0 jpg:- |
    convert "$WALLPAPERS/.temp1.jpg" - +append "$WALLPAPERS/.temp.jpg"

有没有办法摆脱 "$WALLPAPERS/.temp1.jpg" 中介?那么有没有办法将第一个 convert 的输出转移到第三个 convert 的输入?

convert "$WALLPAPER1" -resize "${H[0]}"x"${V[0]}"^ -gravity center -crop "${H[0]}"x"${V[0]}"+0+0 -write mpr:temp1 +delete \
"$WALLPAPER2" -resize "${H[1]}"x"${V[1]}"^ -gravity center -crop "${H[1]}"x"${V[1]}"+0+0 -write mpr:temp2 +delete \
-gravity north mpr:temp1 mpr:temp2 +append "$WALLPAPERS/.temp.jpg"

无需进行 3 次转换调用。您可以写入 memory-program-register (mpr) 而不是写入文件,然后稍后再调用。 +delete 删除原始图像。