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?
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).
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.