Animation loop question

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
metsfan666

Animation loop question

Post by metsfan666 »

I'm trying to set up an animation that does the following:

Displays a sequence of 4 frames 4 times. Then displays a single frame and then restarts from the beginning. I've tried many different ways but can't get it exactly right.
So for example, my first image is like

convert -delay 25 image1.gif image2.gif image3.gif image4.gif -loop 4 output.gif

This creates output.gif that displays each image in order 4 times total.

Then I try this:

convert output.gif -delay 300 oneframe.gif -loop final.gif

I'd expect this to take the first image of 16 cycles, then tack onto the end oneframe.gif. This however is not what happens. final.gif is an image that displays the first 4 frames then my final oneframe.gif and then restarts from the beginning.

Any suggestions?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Animation loop question

Post by anthony »

GIF animation can NOT loop in the middle.

To do what you want you will need to unroll your loop.

Code: Select all

   convert output.gif \
               \( -clone 0--1 \) \( -clone 0--1 \) -delay 300 oneframe.gif \
               -loop 0 final.gif
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply