Developer

Web image format: JPEG

The JPEG format is one kind of Web image format. Learn about JPEG, and find out if it best suites your needs.

By Paul Anderson

The JPEG format supports full 24-bit color. It compresses images by accurately recording the brightness of each pixel but averaging out the hues, which our eyes distinguish less accurately. In effect, it records a description of an image, not the literal composition of that image. The viewer's Web browser or graphics application decodes this description into a bitmap that looks more or less like the original image.

The accuracy of the reconstructed image depends on how much compression is applied—a value you can choose in most JPEG-savvy graphics tools. The decoded hues are rendered in sample blocks with diffused shapes. Since these blocks tend to overlap, it's very difficult—and takes a lot of data—to produce a distinct boundary between colors. But this technique works very well for photographic images with gradual color changes and no sharp edges. Tropical birds, for example, are particularly well suited to the JPEG format.

Both of these images are less than 3.88K

JPEG (3,849 bytes) GIF (3,968 bytes)

On the down side, JPEGs are notoriously difficult to edit. If you open a JPEG and modify it, you're modifying the interpreted bitmap rather than the JPEG data itself. Resaving as a JPEG will put the interpreted bitmap, defects and all, back through the encoding process, and the resulting image will be further degraded. Never resave a JPEG if you don't have to.

One more caveat: For high-quality printing, the JPEG format supports pixel resolutions besides 72 dots per inch (dpi). On the Web, anything over 72dpi is a waste—there's no benefit to higher resolutions as there is when printing onto paper. When saving an image as a JPEG, be sure to double-check the resolution of the image.

Paul Anderson is associate technical editor for CNET Builder.com. His responsibilities don't include handling graphics, so naturally, he handles them all the time.

Editor's Picks

Free Newsletters, In your Inbox