GIFscript, an Animation Scripting Language

Most of the documentation that you will find about constructing animated GIFs will start with the suggestion “First get a program like GIFBuilder or GIF Construction Set. Then you’ll be ready to start making animated GIFs. . . .” These are programs that are available primarily for Windows and Macintosh machines, and they typically have a graphical user interface that will allow you to place images in a certain order and adjust the attributes of the various images in the sequence. The value of these programs is that they allow you to represent the layout of the animation file in a succinct, readable form, and they allow you to describe the layout of files in a more abstract form than what is achievable by the Perl scripts we have looked at so far. However, most of these tools still require you to assemble the scenes of the animation by hand, and they do not store the description of the sequence in a form that is separable from the actual image file. That’s where GIFscript comes in.

GIFscript is actually just a syntax and an interpreter that lets you define the sequence of images in a GIF animation as a simple text file. The interpreter is a Perl script that acts as an interface to the ImageMagick routines that do all the image crunching work. We’ll call the text file that describes the animation a frame description file.

A GIFscript frame description file consists of a number of instructions for adding images to an animation and for controlling ...

Get Programming Web Graphics with Perl and GNU Softwar now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.