JPEG File Compression for the Internet

The Joint Photographic Experts Group is a standards organization that defined the method of data compression used in JPEG files, technically known as the JPEG File Interchange Format (JFIF), and informally as JIF or JPG. The JPEG data compression method is sometimes used in TIFF files, as well as other popular file formats.

JPEG exists to enable users to store and transmit 24-bit color images in significantly fewer bytes than a straight bitmap image would require. JPEG is a "lossy" compression scheme, meaning that image information is irrevocably lost when an image is converted to a JPEG file. JPEG's strength is that the information discarded by JPEG encoding tends to have been redundant information, but at compression ratios greater than 10:1, JPEG introduces artifacts that can be distracting and ugly. For fast transmission and on-screen display via the Internet, however, JPEG is an excellent file format.

The JPEG compression scheme is optimized for photographic color images because adjacent pixel values in photographs are similar in brightness and color. This enables it to extract average brightness and color values for groups of pixels and store the group value, rather than storing separate values for each individual pixel.

The first step in JPEG compression is to separate the luminance (brightness) information from chrominance (color) information. Rather than trying to represent color as RGB values, their common luminance (the Y channel) is split off, and the color is reduced to measures of redness (Cr) and blueness (Cb). Since the eye is more sensitive to small variations in brightness than it is to small variations

Figure 3.2 Enlarged sections of this image of the lunar Straight Wall show blockiness and loss of detail that occurs as a result of mild (4:1) and severe (16:1) image JPEG compression. Because smaller files mean speedier loading of web pages, however, some loss of quality is usually considered acceptable.

Figure 3.2 Enlarged sections of this image of the lunar Straight Wall show blockiness and loss of detail that occurs as a result of mild (4:1) and severe (16:1) image JPEG compression. Because smaller files mean speedier loading of web pages, however, some loss of quality is usually considered acceptable.

in color, chrominance is averaged over several pixels, resulting in a fuzzy quantized representation of the color information that requires fewer bits to be encoded.

Luminance is handled by breaking the image into 8x8 blocks of 64 pixels and extracting spatial frequency information from each block using the discrete cosine transform (related to the Fourier Transform described in Chapter 17). The lowest spatial frequency is the average luminance of the 8 x 8-pixel block, followed by the progressively higher-frequency patterns of light and dark. Each pattern is present in some strength, which is represented by a coefficient. JPEG files include as many coefficients as needed to reach a user-determined image quality, and they drop the coefficients for higher-frequency patterns. At maximum compression, luminance information for 64 pixels takes only one byte (the coefficient of the average luminance), but for better definition in the image, more coefficients of the discrete cosine must be used, resulting in a better defined image with lower compression. At high compressions, the 8 x 8-pixel blockiness is obvious, and discrete cosine transform artifacts appear as a variety of stripes and plaid-like patterns.

JPEG files begin with a simple 20-byte header containing four bytes (FF D8 FF EO hex) to mark the beginning of an image, a format identifier (the string

Section 3.12: RAW, NEF, and CRW: Proprietary Raw Images

JFIF plus 0 0 hex), the JFIF version number, then a four-byte encoding of the pixel aspect ratio, and finally the number of samples and lines in the image. The compressed image then follows as a stream of bytes.

Because JPEG compression is lossy, never store images that will be measured or analyzed in a JPEG file. At best, the original information content of the image is reduced to 8 bits per color channel; and at worst, the image contains compression artifacts as well as brightness and color errors.

Was this article helpful?

0 0
100 Photography Tips

100 Photography Tips

To begin with your career in photography at the right path, you need to gather more information about it first. Gathering information would provide you guidance on the right steps that you need to take. Researching can be done through the internet, talking to professional photographers, as well as reading some books about the subject. Get all the tips from the pros within this photography ebook.

Get My Free Ebook


Post a comment