Colors

One of the less obvious things you need to know to create usable web graphics is that browsers running on 256-color desktops are particularly dictatorial with colors; they use a fixed palette of 206 colors, called the Web or Netscape palette. (See "Web Design in a Nutshell".) The Gimp lets you specify "Web optimized palette" when indexing (making a palette for) images. This is good - but check how the image looks after indexing; the fixed 206 color palette is not a very good match for some images. If you have any control over colors, you might want to pick web-safe colors to avoid dithering or banding when converting to web-safe indexed images.

Indexing can be done outside of the Gimp, too

When you're doing lots of images, it's sometimes better to not index them in Gimp, save them in some truecolor format like .tga or .png, and convert them to indexed images later. Linux comes with several tools that can do batch conversion of images from one format to another, e.g. ImageMagick, a set of batch-mode programs and GUI tools, including the 'convert' and 'mogrify' programs used below. Every tool has its own strengths and weaknesses, so if one can't do what you want, try another. And remember that the Gimp does a pretty good job of indexing, so compare results to make sure you like them.

To convert a bunch of truecolor .tga images to 8-bit GIFs with a web palette, try

	$ mogrify -map netscape: -format gif *.tga

Optimization

The Gimp outputs fairly optimal .gif files, but for one reason or another, many other tools output unoptimized gif files, which means they often take up twice as many bytes as they should. One program that can optimize them is gifsicle. (It doesn't come with Red Hat 5.2, but you can download an rpm from the above page, and install as root with 'rpm -i gif*.rpm'.) To use it to optimize a bunch of gifs, try
	$ gifsicle --batch -O2 *.gif

Going beyond the Web palette safely

On most platforms, browsers have a few (32 or so) extra colors to play with in addition to the web colors, and choose these 32 colors to best fit your images.

You may be able to use these extra 32 colors by computing a common palette for all of your images, e.g. with ImageMagick's convert command:

	$ convert +map -colors 32 *.tga palette.gif
and then converting them into GIFs using that palette, e.g.
	$ mogrify -map palette.gif -format gif *.tga
This may be worth doing if you have very few colors but want to control them precisely.

Other tools

xv is a GUI tool to view and operate on .gif and .png files; see The xv home page, the xv online manual, or just run 'xv foo.gif' and play with the mouse. It's handy for quickly looking at .gif files or munging their color maps interactively.
Dan Kegel