A Complete Guide to Web Design

(やまだぃちぅ) #1
278 Chapter 14 – GIF Format

Minimizing GIF File Sizes


Web Design in a Nutshell, eMatter Edition

Limit dimensions

Though it may seem obvious, the easiest way to keep file size down is to limit the
dimensions of your graphic. There aren’t any numerical guidelines here; just don’t
make graphics larger than they need to be.


  • Scale large images down (see “Resizing tips” in Chapter 3,Web Design Princi-
    ples for Print Designers).

  • Crop out any extra space around the important areas of your image.

  • Avoid large graphics if they are not absolutely necessary.


Design with flat color

You can make design decisions that will take advantage of the way GIF
compresses files. If you design your graphics with flat color from the beginning,
you are basically giving the LZW compression the kind of file it likes—rows of
repetitive pixel colors.


  • Fill areas with solid colors rather than gradients (fades from one color to
    another).

  • Limit the amount of photographic material in your GIFs (use JPEGs for photo
    images).

  • Favor horizontal fields of color in your designs when applicable; for exam-
    ple, horizontal stripes will condense better than vertical stripes.

  • Turn off anti-aliasing when it isn’t necessary. The blur that makes smooth (not
    stair-stepped) contours also adds to the number of colors in the image.


Reduce Bit-Depth/Number of Colors


Although GIF format can support 8-bit color information with a maximum of 256
colors, you don’t necessarily have to use all of them. In fact, you can reduce the
size of a file considerably by saving it with a lower bit-depth, which corresponds
to fewer number of colors (see Table 14-1).

The goal is to find the minimum bit-depth that still maintains the integrity and
overall character of the image.You may be surprised to find how many images

Table 14-1: Color Depth Equivalents for Bit-Depths

Bit depth Number of colors
1-bit 2 (black and white)
2-bit 4
3-bit 8
4-bit 16
5-bit 32
6-bit 64
7-bit 128
8-bit 256
Free download pdf