How can you animate a gif that goes back-and-forth instead of repeating?
Solution 1
How about this:
Just correcting the code above.
cp pic2.jpg pic4.jpg && animate *.jpg
Otherwise the 1st pic would show twice. I don't know if there is an easier way way to do this.
Even on GIMP we have to add the duplicated images.
Solution 2
You can just create a new GIF (here, animation.gif) from pic*.jpg.
Animating with a delay between frames of 0 and a back-and-forth that repeats for ever can be done with:
convert pic*.jpg -set delay 10 -reverse pic*.jpg -set delay 10 -loop 0 animation.gif
(assuming your jpgs are arranged in alphanumeric order).
obtained from here: http://www.noah.org/wiki/ImageMagick (not my site).
Solution 3
can you try this ?
cp pic1.jpg pic4.jpg
cp pic2.jpg pic5.jpg
animate *.jpg
just a guess
Solution 4
You should simply do your animation and layer it in order "pic1, pic2, pic3, pic2." In that order to start with. You will achieve the desired results when it repeats. In other words, you're thinking have (for example) 3 frames that go forwards and then backwards. That doesn't work. This will take up more space, but instead you must have four frames that repeat normally.
Related videos on Youtube
Konstapel Kask
Updated on September 18, 2022Comments
-
Konstapel Kask over 1 year
I'm animating a gif with Imagemagick, I'm doing
animate *.JPG
, and that repeats the animation. But I would like it to go do "pic1, pic2, pic3, pic2, pic1" and repeat, so that it goes back and forth. How can that be done, preferably from a cli?-
Code.Decode about 13 yearsHow many images are there actually in your sequence?
-
WoodrowShigeru over 5 yearsA piggyback question to future readers (if I may … sorry if I may not): does anyone know the official term for this? "Pendulum loop" perhaps? It certainly must have a proper name.
-
-
Konstapel Kask about 13 yearsThat would work, but can't that be done in one command? Embarrassing, but I don't know regular expressions :)
-
Denwerko about 13 yearsclicker4721 have better solution. I havent worked with imagemagick a lot...
-
jahroy about 6 yearsYou can do the same with an existing GIF, though I can't get the delay to work (but I can modify the delay of the resulting bouncing GIF).