There are two image file formats that can be interpreted by all major Web browsers: GIF and JPEG. The question is which one is better? The answer is it depends. For Web safe color, the answer is clear. Only GIF images can guarantee that almost every monitor will be able to display your image as you composed it on your own computer. This should be taken with a small grain of salt because the color balance of every monitor is a little different. However, within limits, GIF can provide pretty uniform access to your Web images if you follow the advice given in this chapter.
JPEG, on the other hand, is an image format that has two major features. The first is it saves images in 24-bit color. For photographs where there are typically subtle variations in color, 24 bits is required to get a high fidelity representation of the image. Of course, out on the Internet, only those who have high-color (16 or 24 bpp) systems can see the image as it was originally composed. The image is dithered for those with low-color (8 bpp) systems.
Alternatively, using only 8 bits of color for a photo is almost certainly insufficient to represent all its color variation. Thus, converting the image to GIF requires dithering anyway. The conclusion is that, for most images having a high degree of color variation, which includes most photographs of real world scenes, the use of JPEG is clearly preferable. It allows those with high-color systems to view the image as it was originally prepared; whereas the degradation in image quality for those with low color systems is similar whether the image is in GIF or JPEG format.
The second major feature of JPEG files is that they can provide a high degree of perceptually optimized image compression. This is useful especially for Web site designers concerned about the overall bandwidth required to view their site. JPEG image files can achieve much greater levels of compression than GIF files can. Furthermore, the degree to which an image is compressed using JPEG can be specified by the user. Thus, for any particular image, it is possible, by making several tries, to find just the right balance between minimizing the file size and maintaining the visual integrity of the image.
The conclusion is that for images with subtle variations, such as most photographs of real world scenes, use JPEG. For images that contain only a small number of colors, such as those created using the GIMP's painting or rendering tools, use a web-safe color palette and save as a GIF.