Skip to Content
Linux Multimedia Hacks
book

Linux Multimedia Hacks

by Kyle Rankin
November 2005
Beginner
330 pages
9h 44m
English
O'Reilly Media, Inc.
Content preview from Linux Multimedia Hacks

Animate Images

Pass arguments to the convert tool to turn a directory of images into an animated GIF—all without opening a GUI tool.

The convert utility has plenty of tricks up its sleeve. One of the tricks is the simple conversion of a series of images into a single animated GIF file. Since convert can handle a large variety of image formats, you don’t even need to start out with a directory of GIF-only images.

When it comes to image processing, convert does a lot of the heavy lifting on its own. In fact, the only option you need to concern yourself with is the -delay option, which specifies, in milliseconds, how long to wait between each image change. You can use the animate tool from the ImageMagick suite to test your animation. To see what your animation would look like with a one-second delay on a directory full of GIF images, type:

	$ animate -delay 100 *.gif

This command displays each image in alphabetical order, one after the other. If you want to display them in a different order, specify the images in that order on the command line. Once you are satisfied with your delay rate you can use the same number with the convert command. To convert a directory of GIF files into a single animated GIF with one second between frames, type:

	$ convert -delay 100 *.gif animated.gif

Because I used a file glob here, I assumed the images were in alphabetical sequence. If they aren’t in order, either specify each file on the command line (with the animated GIF specified last) or rename the files ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

CentOS Bible

CentOS Bible

Christopher Negus, Timothy Boronczyk
Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein

Publisher Resources

ISBN: 0596100760Errata Page