Choosing File Formats
JPEG is the most common file format for images on the Web. Because it supports 24-bit color (which translates to over 16 million colors), it's the ideal format for optimizing photos without sacrificing too much image quality. However, because it does discard a small portion of image information as it optimizes, it's not the best choice for images where detail and sharpness is critical, such as scanned line art, vector graphics, or images containing a lot of type.
If you want to keep the detail in your images as sharp as possible, try using the GIF format. The GIF format sacrifices subtle gradations of tone and color, but retains the sharpness and image detail that can be lost with the JPEG format, making it a good choice for animations, images with transparency, vector graphics, and images with type.
In the pages that follow, I don't go into a lot of detail with regard to the two PNG formats. It's not that I have any qualms with the format or its capacity for optimizing different types of imageswhich, by the way, can be impressive, indeed. It's just that the PNG format does have a couple of limitations significant enough that I recommend against using it.
Foremost among those limitations is its relative newness. PNG hasn't been around as long as GIF and JPEG, and the majority of browsers still don't support the PNG format; so GIF and JPEG are simply more reliable formats for viewing in a wide range of browsers.
And although in some cases PNG-8 images can be slightly smaller than comparable GIF images, PNG formats (particularly PNG-24) tend to produce images markedly larger than their GIF and JPEG counterparts. Keeping with the goal of controlling file size, stick with GIF and JPEG formats for optimizing your images.