Reducing the size of animated GIFs

There's no getting away from the fact that animated GIFs are large. They're basically a set of multiple GIFs in one file. If you don't take steps to minimized their size, then you could be sending unnecessarily large files across the Internet. Fortunately, there are a number of ways of keeping the size down:

  • Cut down on dithering. Dithered GIFs don't compress as well as non-dithered ones; diffusion-dithered GIFs compress worst of all. Because your GIF is animated, the individual frames aren't usually on the screen long enough for any degradation in quality to be noticed.
  • Cut down the number of colors in the image. For instance, if you use a standard palette rather than an optimized one, your GIFs may contain fewer colors and may compress better. There's no hard and fast rule; you may find that a 4-bit optimized GIF is smaller than an 8-bit GIF with a standard palette.
As an example, the animation in the tutorial used a limited set of colors from the standard Netscape palette and each GIF was saved undithered with a standard palette. There was no visible loss of quality over a version saved with an optimized palette and error-diffusion, but the resulting animated GIF was nearly halved in size from 42.4K to 22.4K.

Even 22.4K could be considered too large, and you can push the size even smaller with a little work. As you can see, the animation actually only needs to re-draw certain parts of the GIF between frames - the word 'GIF' never needs to be re-drawn. GIFs with large blocks of color compress well, and the same goes for GIFs with large areas of transparency.

In the original animated GIF, none of the frames were transparent, since each frame needed to overwrite the frame beneath it. However, by using transparency and only masking off those areas of the frame that change, the size of the individual GIFs can be brought down even further. In the extreme case of the first few frames, where nothing changes so that there's a delay before the animation starts, a set of completely transparent compact 2-bit GIFs can be used.

[Reducing the size of the animated GIF]

The screenshot above shows the Xara Webster file used to create the final animated GIF, with the background colored white to show the grey mask (obviously the grey background was reinstated for saving the bitmaps, or the edges of the shapes would have anti-aliased to white). By this trick alone, the GIF size was brought down to 15.6K.

Did this page help you? If not, please email us to tell us why not so we can improve it.

_______________

© Copyright Xara Ltd: page last updated 28 Apr 1997
For more information, contact webmaster@xara.com.