Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
How many images are there actually in your sequence? –  fluteflute May 1 '11 at 19:01
    
12, but I do this quite often and sometimes there is more. –  Konstapel Kask May 1 '11 at 19:03
add comment

4 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

can you try this ?

cp pic1.jpg pic4.jpg
cp pic2.jpg pic5.jpg
animate *.jpg

just a guess

share|improve this answer
    
That would work, but can't that be done in one command? Embarrassing, but I don't know regular expressions :) –  Konstapel Kask May 1 '11 at 19:00
    
clicker4721 have better solution. I havent worked with imagemagick a lot... –  Denwerko May 1 '11 at 19:08
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.