gif animation loop pause

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
degarb

gif animation loop pause

Post by degarb »

I got a script to pull doppler rads each hour, and crop for phone. I animate them and need to keep size down.

I don't see an option for second delay between loops. If I slam extra frames, then size increases.

My current bat line is :
convert -delay 100 c:\docs\wx\CLE6.gif c:\docs\wx\CLE4.gif c:\docs\wx\CLE2.gif c:\docs\wx\CLE0.gif -loop 0 c:\docs\wx\CLEanim.gif

But need it to pause 5 seconds, or so, on the cle0.gif image between loops without adding file size.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: gif animation loop pause

Post by anthony »

There are two ways to pause between looks. Application level and GIF animation level.

The former is for the application doing the animation to pause between loops.
For example

Code: Select all

animate -pause 500 animation.gif
The later is to change the delay either on the first frame or the last frame of the animation

Code: Select all

    convert animation.gif \( +clone -set delay 500 \) +swap +delete  animation_with_pause.gif
See Animation Modification, Frame by Frame Modification
http://www.imagemagick.org/Usage/anim_mods/#frame_mod

Exepecially look further down at Color Morphing
http://www.imagemagick.org/Usage/anim_mods/#morph
Where I specifically modify the time delay of two specific frames in the animation, (what will be the first and middle frames) before turning it into a 'patrol cycle' (back and forth, or reversed) type of animation
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
degarb

Re: gif animation loop pause

Post by degarb »

getting all kinds of errors with those codes:

animate -pause 500 C:\docs\wx\CLExanim.gif
or
convert C:\docs\wx\CLExanim.gif \( +clone -set delay 500 \) +swap +delete C:\docs\wx\CLEx-xanim.gif

The convert code at least creates a file, but not with desired pause. Just longer pauses between gifs, which is not what I want.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: gif animation loop pause

Post by fmw42 »

Anthony's second command was for unix. You need the Windows equivalent ( don't escape the parenthesis, for example). See http://www.imagemagick.org/Usage/windows/ for more details.

The first command should work with no errors even on Windows, unless your version is too old.

Also are you using a current IM? If not upgrade!
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: gif animation loop pause

Post by Drarakel »

Animate (and display) don't work on a plain Windows OS. That's normal. But the animate command was just an example - as Anthony wrote, you would have to specify the pause in the application/hardware that does the animation for you.
So, better use his second command (without the escapes).
Or you can probably specify the different delays in your very first command:

Code: Select all

convert -delay 100 c:\docs\wx\CLE6.gif c:\docs\wx\CLE4.gif c:\docs\wx\CLE2.gif -delay 500 c:\docs\wx\CLE0.gif -loop 0 c:\docs\wx\CLEanim.gif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: gif animation loop pause

Post by fmw42 »

Code: Select all

convert -delay 100 c:\docs\wx\CLE6.gif c:\docs\wx\CLE4.gif c:\docs\wx\CLE2.gif -delay 500 c:\docs\wx\CLE0.gif -loop 0 c:\docs\wx\CLEanim.gif
Might it not be better to put the long delay before the first frame rather than just before the last frame. So try this.

Code: Select all

convert -delay 500 c:\docs\wx\CLE6.gif -delay 100 c:\docs\wx\CLE4.gif c:\docs\wx\CLE2.gif c:\docs\wx\CLE0.gif -loop 0 c:\docs\wx\CLEanim.gif
WITHDRAWN --- It actually looks better to do it with the long delay at the end. SORRY.
degarb

Re: gif animation loop pause

Post by degarb »

Drarakel wrote:Animate (and display) don't work on a plain Windows OS. That's normal. But the animate command was just an example - as Anthony wrote, you would have to specify the pause in the application/hardware that does the animation for you.
So, better use his second command (without the escapes).
Or you can probably specify the different delays in your very first command:

Code: Select all

convert -delay 100 c:\docs\wx\CLE6.gif c:\docs\wx\CLE4.gif c:\docs\wx\CLE2.gif -delay 500 c:\docs\wx\CLE0.gif -loop 0 c:\docs\wx\CLEanim.gif

I like this line. Exactly what I need. Will try it later..

I think I get what you mean "spec the pause in the application/hardware...". But remember I am making radars that will display on equipment I cannot control: a non smart phone, and viewing at library/home (3 computers)/vacations/ on customer's computers on occasions. I hardly can fiddle with most of these browsers' setting to delay a loop.
JacobVegas
Posts: 1
Joined: 2016-12-06T02:29:02-07:00
Authentication code: 1151

Re: gif animation loop pause

Post by JacobVegas »

Here is how I added a delay of 5 seconds between loops. I have 74 images named Main00.jpg to Main74.jpg

Code: Select all

convert  /Users/Jacob/Desktop/addBanner_assets/jpegs/Main*.jpg  -delay 500 /Users/Jacob/Desktop/addBanner_assets/jpegs/Main74.jpg  -loop 0  /Users/Jacob/Desktop/addBanner_assets/jpegs/output.gif 


I Have it convert all the files named Main*.jpg into the animation then I have it pause 5 seconds and re add the last image then loop. Yes it adds one extra frame to the animation but I always could delete frame 74 and repeat 73 twice if the extra frame was an issue for timing reasons
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: gif animation loop pause

Post by anthony »

You can either merge the last two frames (times are added) using... -layers RemoveDups
See http://www.imagemagick.org/Usage/anim_opt/#removedups
This is also automatically done by -layers OptimizePlus

Or just delete the second last from using -delete -2

WARNING: you don't set a default delay for your animation sequence. That is they are all 'ZeroDelayFrames'.
This is Bad as it promotes the continued bad behaviour of web browsers and other animation programs!

See Zero Delay Intermediate Frames
http://www.imagemagick.org/Usage/anim_basics/#zero
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply