Image File Formats


On the Internet, the Graphics Interchange Format (GIF) is the most commonly used format for storing bitmap graphics files. This is followed by the Joint Photograhics Experts Group (JPEG) format, which is commonly used to store photographic data. Many programs exist that are capable of converting from one format to another. For example, programs exist that convert windows bitmap, tiff and pcx formats to GIF format and vice verça.

The GIF Format

There are two versions of the GIF format: GIF87 and GIF89a. The latter version is capable of making a single color in the image transparent. This is advantageous in situations where the image will be overlaid, and that which lies underneath needs to be visible through certain portions of the image.

The GIF format has the following properties:

The compression algorithm used for GIF performs best when there are fewer colors and when large sections of the image are of a uniform color. The GIF format is not particularly suited to photographic images because of the variety of colors and the lack of uniformity. The JPEG format is typically used for photographic images.

Upon displaying a GIF image, a browser usually produces a low resolution form of an image prior to displaying the image at full resolution. If a browser has this capability then the first preview of the image is produced when 1/8 of the image data has been read.

The number of colors that may be displayed simultaneously is usually dependent upon the video hardware in a particular computer. VGA has only 16 colors; while Super VGA is often capable of displaying 256 colors or more. Full 24 bit color implies that more than 16 million colors are available. When a GIF file is rendered, if the number of bitmap colors is greater than the number of colors in the physical palette, color dithering (approximation) is used to render the image as truly as possible. If two 256 color GIF bitmaps are being displayed simultaneously then up to 512 colors may be required in the physical color palette to render both images exactly.

The JPEG Format

The JPEG format was designed to store photographic information in a compressed form. The lossy compression technique is used. The compression ratio may be varied when storing an image in JPEG form. When an image is compressed using the JPEG format, portions of the image are dropped, and interpolated upon decompression. The higher the compression ratio that is used, the greater the loss of precision in the image upon decompression. The JPEG format is unsuitable for images containing typed text because of the hard edges presented by the text.

Standard JPEG images do not support interlacing or transparency.

The next section next.gif discusses some of the attributes applicable to the tag <img>.