Page 1 of 1

GIF animation: how to pause at specific frame?

Posted: 2014-03-08T08:43:16-07:00
by clkdiv
Hello girls and guys, I want to make an animated GIF from 50 JPGS and want to loop it backward when the end is reached. Now I don't know if this is possible at all, play backwards in a anmated GIF?

If not, I am planning to duplicate the files physically on hard disk, name them reverse and then have a "workaround" playback made from 100 JPGs instead of 50. So my first question is whether it is possible to reverse play a GIF?

The other question I have is this: I would like to pause the animation at the first frame for a second, then playback at 12,5fps to the 25th frame, pause a second again, then playback to the 50th frame and pause once more. Afterwards all this backwards.

I have tried to figure out myself, but without success. Could anyone help me with that? I would appreciate your proposals very much! Thanks! Martin...

Re: GIF animation: how to pause at specific frame?

Posted: 2014-03-08T08:56:57-07:00
by snibgo
I do video rather than animated gifs, so I would do all of that externally to IM, copying files.

However, you can probably do most of this within convert. "-clone" can copy any or all of all the frames, "-reverse" can reverse them. "-duplicate" can duplicate a range of frames, effectively making them last twice (or more) as long.

See http://www.imagemagick.org/script/comma ... #duplicate etc.

Re: GIF animation: how to pause at specific frame?

Posted: 2014-03-08T11:04:30-07:00
by fmw42
You will have to put in a new delay after each 50 (or desired number of ) frames. You may need to create separate animations with the desired number of frames for any given delay, then combine all the animations into one.

Re: GIF animation: how to pause at specific frame?

Posted: 2014-03-08T11:17:14-07:00
by fmw42
Do the following if I have not made a mistake. Note that 12.5 frame per second needs 13 frame to make just over 1 sec delay. Also 1/12.5=0.08 tics at 100 tics in 1 second so each tic is 0.01 seconds or your total tics = 0.08 seconds

convert *.jpg -delay 8 \
\( -clone 0 -duplicate 13 \) \
\( -clone 1-24 \) \
\( -clone 25 -duplicate 13 \) \
\( -clone 26-49 \) \
-delete 0-49 \
\( -clone 1--1 -reverse \) \
-loop 0 \
animation.gif

Let us know if this works and if not what happens. I may have made a mistake.

Re: GIF animation: how to pause at specific frame?

Posted: 2014-03-09T01:56:46-07:00
by clkdiv
Thanks a lot for you answer! The last solution proposed here by fmw42 (thanks!) worked for the first 50 frames, but did not reverse. However as soon as I grasped really how IM works I did it all with a single huge command line, explicitely naming all singe jpgs, which enables me to put the delay whereever I want. And I suppose it is also the fastest way, avoiding IM to have reverse and delete and so on?

However, it looks very ugly, but works like charme:

Code: Select all

convert -delay 1x1 001.jpg -delay 1x12 002.jpg 003.jpg 004.jpg 006.jpg 007.jpg 008.jpg 009.jpg 010.jpg 011.jpg 012.jpg 013.jpg 014.jpg 015.jpg 016.jpg 017.jpg 018.jpg 019.jpg 020.jpg 021.jpg 022.jpg 023.jpg 024.jpg -delay 1x1 025.jpg -delay 1x12 026.jpg 027.jpg 028.jpg 029.jpg 030.jpg 031.jpg 032.jpg 033.jpg 034.jpg 035.jpg 036.jpg 037.jpg 038.jpg 039.jpg 040.jpg 041.jpg 042.jpg 043.jpg 044.jpg 045.jpg 046.jpg 047.jpg 048.jpg 049.jpg -delay 1x1 050.jpg -delay 1x12 049.jpg 048.jpg 047.jpg 046.jpg 045.jpg 044.jpg 043.jpg 042.jpg 041.jpg 040.jpg 039.jpg 038.jpg 037.jpg 036.jpg 035.jpg 034.jpg 033.jpg 032.jpg 031.jpg 030.jpg 029.jpg 028.jpg 027.jpg 026.jpg -delay 1x1 025.jpg -delay 1x12 024.jpg 023.jpg 022.jpg 021.jpg 020.jpg 019.jpg 018.jpg 017.jpg 016.jpg 015.jpg 014.jpg 013.jpg 012.jpg 011.jpg 010.jpg 009.jpg 008.jpg 007.jpg 006.jpg 005.jpg 004.jpg 003.jpg 002.jpg -loop 0 animation.gif
Thanks a lot for your suggestions!

Re: GIF animation: how to pause at specific frame?

Posted: 2014-03-09T11:08:50-07:00
by fmw42
I made a small mistake. It should have been 0--1

convert *.jpg -delay 8 \
\( -clone 0 -duplicate 13 \) \
\( -clone 1-24 \) \
\( -clone 25 -duplicate 13 \) \
\( -clone 26-49 \) \
-delete 0-49 \
\( -clone 0--1 -reverse \) \
-loop 0 \
animation.gif

However, -reverse may be too new for your IM version. It was introduced at 6.3.4.

It is always a good idea to post your IM version and platform when asking questions.