Previous Tip  |  Next Tip  |  Design Tips   | [Bill's Home]

Graphic file formats

Where bandwidth is limited it is sometimes a good idea to make images as small as possible, and still be able to portray the required information. Two of the main techniques are:

To reduce the number of pixels in the graphic, as this wastes bandwidth to display a graphic which is scaled down. For example never use a width and height tag in an image insert which is not equal to the graphics' size.

Reduce the number of colors in the image.

For example the following shows four pictures taken with 16.7 million colors, 32 colors, 8 colors and 4 colors, respectively:

16.7 colors (JPEG format) - 3.62KB
32 colors (GIF format) - 2.42KB
16.7 million colors
32 colors
8 colors (GIF format) - 1.10KB
4 colors (GIF format) - 564B
8 colors
4 colors

Even when the colors have been reduced, you can still see that the image is of a cat. The sizes of the files produced are 3.62KB, 2.42KB, 1.10KB and 562B. It can be seen that reducing the number of colors in the image has a considerable effect on the file size (and the bandwidth used, of course, if the image is being sent over a communications channel). The reason that the file sizes reduce is that the file are compressed using an algorithm which detects long sequences of the same color, and replaces it with a special code. Thus the fewer the colors, the more likely these sequences will occur, thus the smaller the file size will be.