This is a brief guide to using The Gimp
to create mpegs and animated GIFs. The Gimp is the Gnu Image
Manipulation Program, and is an almost perfect tool for creating
web graphics. The Gimp is included with almost every distribution so
should already be available for use. Using the latest stable version is
recommended (currently 1.2.2) but I have had only occasional glitches
with the developer versions.
The example frames for this tutorial are located here .
HINT: Use your browser's Save Link As function to download the
anim_tutorial.tgz file to your local drive. Extract the tarball with:
> tar xfvz anim_tutorial.tgz
-
Create your images in POVRay and save them to a new directory. Image
names should be in the form filename####.ext. That is, use a four digit
sequence number. You can change the name of the POVRay source file to include
a zero pad to trick POVRay into creating the correct extension. E.g.,
change the filename from myscene.pov to myscene00.pov if there are fewer
than 100 images in the sequence. For 100 to 999 images, change this to
myscene0.pov, etc..
-
After the images are finished rendering, load the first image into Gimp.
-
Once the first image is loaded, in this case I use the fan0001.ppm file,
the image will appear in a new window. The next step is to open the
VCR Navigator by right-clicking the image, then selecting Video then
VCR Navigator.
-
You may get dialogs similar to the following:
Select "Save Flattened" and "Raw" to continue.
-
The VCR Navigator window will appear. If only the first image in the sequence
appears, click on the Smart Update button (highlighted below) to load the
remaining images.
-
Click once on the Playback button.
-
Two new windows will appear.
-
Use the Animation Playback window to preview your image. A common
mistake when creating looped animations is to have the last image
and the first image identical. When the animation runs it will seem
to stutter for a moment because it's using two frames for the single
image. POVRay has an option to automatically account for this duplicate
frame, so use it if you intend to create loops.
When you are satisfied with the animation, close the Animation Playback
window.
-
Right click on the new Untitled window to bring up the SaveAs dialog.
Make sure that "By Extension" is selected.
You'll notice that GIF is not available from the "Determine File Type" menu.
This occurs if your image is not in an indexed format. You can manually
add an index by right clicking the image then selecting Image|Mode|Indexed
from the menus. However, Gimp will do this automatically if requested.
Enter the filename with a .gif extension then click OK. A dialog similar to
the following will appear:
Select "Save as Animation" and "Convert to Indexed Using Default Settings"
then click the "Export" button.
-
A final dialog will appear requesting GIF comment information. If you want
a looping animation, select the "Loop Forever" button. You can also decrease
the delay between frames or select the Interlace option (please email me if
you know what this does!). Click OK to save the image.
-
That's it! The new GIF animation is complete.
Gimp is used as a front-end to the mpeg2encode binary to create MPEG2 videos. You
can use mepg2encode from the command line with custom scripts if you need more control
over the process.
-
Download the mpeg2encode source from ftp.mpeg.org. If you cannot locate
the file I have archived a copy here.
-
Extract the tarball, cd to the newly created mpeg2 directory, then run make.
It should build cleanly on most systems (i.e., I've tried it on Debian and
Mandrake without problem). When it's finished, copy the
./mpeg2/src/mpeg2enc/mpeg2encode binary to someplace in your path.
Hint: If you are running an AMD K6-2 processor, I've found the following
modifications to the Makefile can gain a 5-15% improvement:
Edit the ./mpeg2/Makefile and change the following line:
CFLAGS = -O2
to
CFLAGS = -O6 -DARCH=k6 -DCPU=k6 -ffast-math -fomit-frame-pointer-malign-loops=2
-
As is the case when creating GIF animations, the filename format must be in
the form filename####.ext.
-
After the images are finished rendering, load the first image into Gimp.
Right click the image, select Video|Encode|Mpeg2. You'll get a screen similar
to the following:
Select the frame sequence and the output filename. When you are satisfied,
select Gen+Encode. A window will pop up showing the state of the encode.