Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.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
在Windows上与ImageMagick并排附加两个GIF_Windows_Imagemagick - Fatal编程技术网

在Windows上与ImageMagick并排附加两个GIF

在Windows上与ImageMagick并排附加两个GIF,windows,imagemagick,Windows,Imagemagick,在Linux Ubuntu上,我可以使用以下命令附加两个相同大小、相同帧数的动画GIF: convert file1.gif'[0]' -coalesce \\( file2.gif'[0]' -coalesce \\) \\ +append -channel A -evaluate set 0 +channel \\ file1.gif -coalesce -delete 0 \\ null: \\( file2.gif -coale

在Linux Ubuntu上,我可以使用以下命令附加两个相同大小、相同帧数的动画GIF:

convert file1.gif'[0]' -coalesce \\( file2.gif'[0]' -coalesce \\) \\
          +append -channel A -evaluate set 0 +channel \\
          file1.gif -coalesce -delete 0 \\
          null: \\( file2.gif -coalesce \\) \\
          -gravity East -layers Composite output.gif
您也可以在此处找到此命令:

在Windows上,此命令不起作用。它会生成错误:

convert torusEnlargingSpheres3.gif'[0]' -coalesce \\( torusEnlargingSpheres6.gif'[0]' -coalesce \\) +append -channel A -evaluate set 0 +channel torusEnlargingSpheres3.gif -coalesce -delete 0 null:: \\( torusEnlargingSpheres6.gif -coalesce \\) -gravity East -layers Composite output.gif

convert.exe: UnableToOpenBlob `torusEnlargingSpheres3.gif'[0]'': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: NoDecodeDelegateForThisImageFormat `GIF'[0]'' @ error/constitute.c/ReadImage/504.
convert.exe: UnableToOpenBlob `\\(': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/504.
convert.exe: UnableToOpenBlob `torusEnlargingSpheres6.gif'[0']': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: NoDecodeDelegateForThisImageFormat `GIF'[0']' @ error/constitute.c/ReadImage/504.
convert.exe: UnableToOpenBlob `\\)': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/504.
convert.exe: UnableToOpenBlob `\\(': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/504.
convert.exe: UnableToOpenBlob `\\)': No such file or directory @ error/blob.c/OpenBlob/2701.
convert.exe: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/504.
要在Windows上使用此命令,我应该更改什么

此命令不会生成错误,但不会附加图像:

convert file1.gif"[0]" -coalesce ^( file2.gif"[0]" -coalesce ^) +append -channel A -evaluate set 0 +channel file1.gif -coalesce -delete 0 null:: ^( file2.gif -coalesce ^) -gravity East -layers Composite output.gif

Windows上的报价与Unix上的报价不同。下面是关于如何从Linux引用转换为窗口引用的一些想法。请注意,大多数在线ImageMagick示例都使用Linux风格的引用,因此这对任何Windows用户都特别重要

一,。行延拓

在Linux上,反斜杠用作行延续字符,但Windows使用插入符号^,因此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
二,。将单引号替换为双引号

在Linux上,参数可以用单引号引用,但在Windows上,需要双引号,因此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
三,。转到Windows时需要删除某些字符

在Linux上,某些字符需要在前面加反斜杠来转义,例如!但这在Windows上是不必要的,因此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
四,。倍增百分数符号

从Linux到Windows时加倍百分比符号,因此此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
五,。转到Windows时,需要添加一些字符


某些字符在移动到Windows时需要在其前面添加插入符号才能转义,例如|、&、>和在Windows上引号与Unix上引号是不同的。下面是关于如何从Linux引用转换为窗口引用的一些想法。请注意,大多数在线ImageMagick示例都使用Linux风格的引用,因此这对任何Windows用户都特别重要

一,。行延拓

在Linux上,反斜杠用作行延续字符,但Windows使用插入符号^,因此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
二,。将单引号替换为双引号

在Linux上,参数可以用单引号引用,但在Windows上,需要双引号,因此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
三,。转到Windows时需要删除某些字符

在Linux上,某些字符需要在前面加反斜杠来转义,例如!但这在Windows上是不必要的,因此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
四,。倍增百分数符号

从Linux到Windows时加倍百分比符号,因此此Linux:

convert image.png image.png \
   +append result.png
convert 'image with spaces.png' info:
convert image.png \( image.png -negate \) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51% txt:
convert image.png -resize 1024x768\> result.png
convert input.png -auto-level result.png    # comment
此窗口变为:

convert image.png image.png ^
    +append result.png
convert "image with spaces.png" info:
convert image.png ( image.png -negate ) +append result.png
convert xc:"gray(128)" -depth 8 -threshold 51%% txt:
convert image.png -resize 1024x768^> result.png
五,。转到Windows时,需要添加一些字符


某些字符在移动到Windows时需要在其前面添加插入符号才能转义,例如|、&、>和但我不知道如何修复该命令。让我提供Windows的配置文件

这是:

1文件a-0001.gif中file1.gif的单独帧,…:

文件aa-0001.gif中的2个单独的file2.gif帧,…:

3使用%%nxf并排附加帧以获得相对路径-重要信息:

for /r %f in (a-*.gif) do convert %f a%~nxf +append %f
4连接附加的框架:

convert -loop 0 -delay 20 a-*.gif result.gif

我仍然不知道如何修改命令。让我提供Windows的配置文件

这是:

1文件a-0001.gif中file1.gif的单独帧,…:

文件aa-0001.gif中的2个单独的file2.gif帧,…:

3使用%%nxf并排附加帧以获得相对路径-重要信息:

for /r %f in (a-*.gif) do convert %f a%~nxf +append %f
4连接附加的框架:

convert -loop 0 -delay 20 a-*.gif result.gif

我可能会用这样的东西来模拟+append

convert ( file1.gif -coalesce -set page %[fx:w*2]x%[h]+0+0 -coalesce ) ^
   null: ( file2.gif -coalesce ) -gravity east -layers composite ^
   -set delay 20 -loop 0 result.gif
读入文件1 GIF,合并,并设置其页面几何图形以将其扩展到右侧宽度的两倍。再次合并以创建额外的画布区域

然后包含null:以将file1帧与file2帧分开

然后读入文件2 GIF并合并它

最后,将重力设置为“东”,并使用-layers composite在其伙伴file1帧的扩展区域上合成每个file2帧。将延迟和循环设置为0,并命名输出文件

这样做的命令看起来像这样

convert ( file1.gif -coalesce -set page %[fx:w*2]x%[h]+0+0 -coalesce ) ^
   null: ( file2.gif -coalesce ) -gravity east -layers composite ^
   -set delay 20 -loop 0 result.gif

要在BAT脚本中使用这样的命令,请将单百分号%转换为双百分号%。

我可能会用这样的东西模拟+附加

convert ( file1.gif -coalesce -set page %[fx:w*2]x%[h]+0+0 -coalesce ) ^
   null: ( file2.gif -coalesce ) -gravity east -layers composite ^
   -set delay 20 -loop 0 result.gif
读入文件1 GIF,合并,并设置其页面几何图形以将其扩展到右侧宽度的两倍。再次合并以创建额外的画布区域

然后包含null:以将file1帧与file2帧分开

然后读入文件2 GIF并合并它

最后,将重力设置为“东”,并使用-layers composite在其伙伴file1帧的扩展区域上合成每个file2帧。将延迟和循环设置为0,并命名输出文件

这样做的命令看起来像这样

convert ( file1.gif -coalesce -set page %[fx:w*2]x%[h]+0+0 -coalesce ) ^
   null: ( file2.gif -coalesce ) -gravity east -layers composite ^
   -set delay 20 -loop 0 result.gif
要在BAT脚本中使用这样的命令,请将

百分比符号%转换为双斜杠%。

我认为您需要用插入符号^替换双斜杠,其中用作行连续字符。在打开和关闭括号之前删除两个反斜杠。并用双引号替换单引号。@MarkSetchell谢谢。我试过了,不成功。请编辑您的问题以显示您的尝试,谢谢。再看看这个答案的底部@MarkSetchell我刚刚编辑过。谢谢你的链接。我不认为你需要括号前的插入符号。很抱歉,我对Windows的了解有限。我认为您需要用插入符号^替换双斜杠(用作行继续字符)。在打开和关闭括号之前删除两个反斜杠。并用双引号替换单引号。@MarkSetchell谢谢。我试过了,不成功。请编辑您的问题以显示您的尝试,谢谢。再看看这个答案的底部@MarkSetchell我刚刚编辑过。谢谢你的链接。我不认为你需要括号前的插入符号。很抱歉,我的Windows知识有限。要垂直附加,我们必须更改什么?0+0%[fx:w*2]x%[h]和重力南方?不。。。我没有找到如何垂直追加。有什么想法吗?您可以使用-set page%[h]x%[fx:h*2]+0+0-coalesce设置页面几何图形,使file1.gif帧的高度加倍。然后使用-gravity south和-layers composite将file2.gif帧合成到扩展的较低区域file1.gif帧上。结果是-垂直追加。谢谢。它起作用了。但是它不是更像是%[w]x%[fx:h*2]+0+0而不是%[h]x%[fx:h*2]+0+0吗?在我的例子中,宽度=高度,所以没有区别。我的错误。在FX表达式中,w是宽度,h是高度。要垂直附加,我们需要更改什么?0+0%[fx:w*2]x%[h]和重力南方?不。。。我没有找到如何垂直追加。有什么想法吗?您可以使用-set page%[h]x%[fx:h*2]+0+0-coalesce设置页面几何图形,使file1.gif帧的高度加倍。然后使用-gravity south和-layers composite将file2.gif帧合成到扩展的较低区域file1.gif帧上。结果是-垂直追加。谢谢。它起作用了。但是它不是更像是%[w]x%[fx:h*2]+0+0而不是%[h]x%[fx:h*2]+0+0吗?在我的例子中,宽度=高度,所以没有区别。我的错误。在FX表达式中,w是宽度,h是高度。