Imagemagick convert command: set delay time for the last frame

瘦欲@ 提交于 2020-05-25 06:35:44

问题


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

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.

So how can I do this with the convert command?


回答1:


You can do it like this:

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



来源:https://stackoverflow.com/questions/40191000/imagemagick-convert-command-set-delay-time-for-the-last-frame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!