A system for compressing an image. The system determines a set of commonly
occurring color values in the image and associates a designator with each
commonly occurring color value. For each pixel in the image, the system
identifies a color value for the pixel. If the pixel has a commonly
occurring color value, the system substitutes the associated designator
for the commonly occurring color value. Otherwise, if the pixel does not
have a commonly occurring color value, the system adds the color value to
a rare color list, and substitutes a special designator for the color
value to indicate that the color value for the pixel is contained in the
rare color list.