Imagemagick convert命令:设置最后一帧的延迟时间 [英] Imagemagick convert command: set delay time for the last frame
问题描述
我有一些名为'_tmp * .png'的.png文件,我想通过使用imagemagick的convert命令将它们转换为gif文件.所以我可以使用
I have some .png files named '_tmp*.png' and I want to convert them into a gif file by the convert command with imagemagick. So i could use
convert -delay 20 _tmp*.png result.gif
但是,我希望最后一帧在屏幕上保持一会儿,以便人们可以更清楚地看到动画的结尾.说,我希望最后一帧持续3秒,同时保持其他帧的延迟时间不变.我研究了convert命令的文档,但似乎没有这种选择.
However I want the last frame to hold for a while on screen so that one can see the ending of the animation more clearly. Say, I want the last frame to last for 3 seconds while keeping the delay time for the other frames not changed. I studied the document for the convert command but it seems it does not have such a choice.
那么如何使用convert命令执行此操作?
So how can I do this with the convert command?
推荐答案
您可以这样做:
convert -delay 40 {1..9}.png -delay 300 10.png -delay 40 {11..14}.png animated.gif
基本上,您将延迟设置为要影响的图像之前,并且在更改之前一直保持不变.
Basically, you set the delay just before the image you want it to affect and it stays set until you change it.
如果您想设置可变延迟,以使第一帧(此处为黑色)和最后一帧(即此处为黄色)显示更长,则可以执行以下操作:
If you want to set a variable delay, so that the first (i.e. black here) and the last frame (i.e. yellow here) are displayed longer, you can do this:
convert -size 300x200 xc:black xc:red xc:lime xc:blue xc:cyan xc:magenta xc:yellow -set delay '%[fx:t==(n-1) || t==0 ? 400 : 40]' result.gif
这篇关于Imagemagick convert命令:设置最后一帧的延迟时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!