Chapter 27. Choosing the Right Image File Type
Image files come in many different formats, but only a few of these work well on the Web. Browsers that display graphics tend to cluster their support around the most common file types, but, as you might expect, browsers don't agree on exactly which types of graphics files to display. The Microsoft browser, for instance, supports Windows bitmap files (BMP), but the Netscape browser does not.To decide which image formats to use on your site, ask yourself two questions:Which file types work in all the major browsers?Of those file types, which one creates the lightest file size without sacrificing image quality?
TIPThe GIF and PNG file types are very similar. You use them for the same types of images, and they give you about the same file weight. Once upon a time, the main difference was that the GIF format was the property of CompuServe, while PNG has always been nonproprietary. However, the patent on GIFs has since expired worldwide, and the format now belongs to the world. |
GEEKSPEAKA palette is an image file's built-in color chart. GIFs and PNGs have palettes of up to 256 colors, while JPEGs don't have palettes and therefore aren't limited to 256 colors. |
TIPDefinitely mix and match image types on your site. Don't fall into the trap of using all JPEGs or GIFs. Pick the format that works best for each particular image. Professional graphics software such as Adobe Photoshop and Macromedia Fireworks allow you to compare the various formats for your images side by side, so you don't have to play the guessing game. |
FILE TYPE | PRONOUNCED | STANDS FOR | PALETTE? | TRANSPARENCY? | ANIMATION? |
---|---|---|---|---|---|
GIF | jiff or giff | Graphics Interchange Format | Yes; up to 256 colors | Yes; one level of transparency | Yes |
JPEG | jaypeg | Joint Photography Experts Group | No; no color limit | No | No |
PNG | ping | Portable Network Graphics | Yes; up to 256 colors | Yes; multiple levels of transparency | No |