Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 你能帮我去掉imagemagick convert命令中的中间输出吗?_Bash_Imagemagick Convert - Fatal编程技术网

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

Bash 你能帮我去掉imagemagick convert命令中的中间输出吗?,bash,imagemagick-convert,Bash,Imagemagick Convert,我在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

我在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"
有没有办法摆脱
“$wallpaps/.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个转换呼叫。您可以将数据写入内存程序寄存器(mpr),然后在以后调用,而不是写入文件。
+delete
删除原始图像

也许您可以使用
进程组
,比如
{convert WP1…;convert WP2…;}| convert WP/temp1.jpg-…
?进程组(在
{…;…;…n;}
中定义)组合所有std输出,并将其呈现给管道中的下一个读取器。祝你好运,很有趣。。。我找到了一种方法,只调用convert一次就可以将中介体写入内存程序寄存器。我将查看
流程组
,并尝试看看哪一个更高效和直观。