为什么我的Imagemagick转换不考虑loop参数? [英] Why doesn't my Imagemagick convert consider the loop parameter?
问题描述
我正在使用以下命令:
convert -delay 10 -loop 1 -density 300 myfile.pdf myfile.gif
在Windows 10上,
以及除loop参数之外的所有参数都可以正常工作:即使将其设置为1
,我也始终会遇到无限循环.
on Windows 10 and all works well except for the loop parameter: even if I set it to 1
, I always get an infinite loop.
我在做什么错了?
推荐答案
我做了一些实验,将-loop
参数从0更改为3,并使用一个简单的红色框,然后是一个蓝色框,如下所示:
I did some experiments varying the -loop
parameter from 0 through 3 and using a simple red frame followed by a blue frame as follows:
for i in 0 1 2 3; do
echo i=$i
((d=80+i))
convert -delay $d -loop $i -size 256x256 xc:red xc:blue a.gif
identify -verbose a.gif | grep -E "Iter|Delay"
done
结果
i=0
Delay: 80x100
Iterations: 0
Delay: 80x100
Iterations: 0
i=1
Delay: 81x100
Delay: 81x100
i=2
Delay: 82x100
Iterations: 2
Delay: 82x100
Iterations: 2
i=3
Delay: 83x100
Iterations: 3
Delay: 83x100
Iterations: 3
因此,似乎-delay
参数和-loop
参数是在GIF文件中正确设置的,尽管-loop
如果为1
,则将其省略,这是默认设置无论如何.
So, it seems that the -delay
parameter and -loop
parameter ARE correctly set in the GIF file, although the -loop
is omitted if it is 1
which is the default anyway.
然后,我使用quicklook
功能在OSX中查看了动画GIF,在其中点击了 Finder 中的␣(SPACEBAR),但它不遵守
I then looked at my animated GIF in OSX using the quicklook
feature where you tap the ␣ (SPACEBAR) in Finder and it does not respect the -loop
setting, however, if you open the GIF in Safari or Firefox it does respect the setting, so I am guessing it is not very standardised and whatever you are using to view the GIF files is not compliant with the poorly-followed standard.
我可能是错的,但是请尝试使用其他查看器,例如Firefox或Chrome.
I may be wrong but try using a different viewer such as Firefox or Chrome.
这篇关于为什么我的Imagemagick转换不考虑loop参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!