« Sunset from Science B | Main | Playing with gnuplot »

Turning a PDF into an animated GIF

Today I was asked to take a bunch of PDF files (essentially frames of the animation) into an animated GIF. This is actually a fairly simple task todo with [imagemagick] and its fast too. Simply all you have todo (assuming the PDF, or other image files etc are in order) is:

convert -delay 20 -loop 0 frame*.pdf output.gif

The -delay 20 specifies the time between frames and the -loop 0 tells the image to loop forever.
Quite nice really (the animation is for a conference and so I won't post it).

The only issue I had is I wanted it to stay on the last frame for a while, but this was simply accomplished by a bit of bash before running the above:

for i in $(seq 28 1 38) do cp -r frame27.pdf frame$i.pdf done

Thus this took frame 27 and copied it in a sequence from 28 to 38. Sweet.

Finally I was asked to put two animations next to each and this can be done by using the append functionality:


for i in $(seq 01 01 38)
do
convert frameset1/frame$i.pdf frameset2/frame$i.pdf +append output$i.pdf
done

This adds the same frame number from each set next to each other in one larger image. Once this is done it is a simple procedure of running the earlier animation script on the newly created pdfs.


TrackBack

TrackBack URL for this entry:
http://www.krioma.net/cgi-bin/mt_new/mt-tb.cgi/422

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on February 10, 2010 2:57 AM.

The previous post in this blog was Sunset from Science B.

The next post in this blog is Playing with gnuplot.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.33