Welcome to the JPEG Tutorial!

This page presents a brief description of how JPEG compresses images. JPEG, unlike other formats like PPM, PGM, and GIF, is a lossy compression technique; this means visual information is lost permanently. The key to making JPEG work is choosing what data to throw away.

Introduction

JPEG is the image compression standard developed by the Joint Photographic Experts Group. It works best on natural images (scenes). This tutorial describes general JPEG compression for greyscale images; however, JPEG compresses color images just as easily. For instance, It compresses the red-green-blue parts of a color image as three separate greyscale images - each compressed to a different extent, if desired. The section, comparison of JPEG images, displays both color and black and white images compressed with JPEG.

How JPEG works

Figure one describes the JPEG process. JPEG divides up the image into 8 by 8 pixel blocks, and then calculates the discrete cosine transform (DCT) of each block. A quantizer rounds off the DCT coefficients according to the quantization matrix. This step produces the "lossy" nature of JPEG, but allows for large compression ratios. JPEG's compression technique uses a variable length code on these coefficients, and then writes the compressed data stream to an output file (*.jpg). For decompression, JPEG recovers the quantized DCT coefficients from the compressed data stream, takes the inverse transforms and displays the image. Figure 1 shows this process.

Testing Methods and Results

What does JPEG look like? How far can one compress an image and have it look identical to the original? presentable? merely recognizable? The comparison of JPEG images answers these questions. This section tests color and b/w pictures compressed at different levels. The original images are in PBM format. Version 3.0 of XV, the imaging system for X-Windows, implemented the JPEG compression.

References

Many books and articles discuss JPEG in more detail. An anonymous FTP site for more JPEG documentation is: ftp.uu.net/graphics/jpeg/.

Index of Hyperlinks

Below are all the hyperlinks used in this document.

Discrete Cosine Transform
JPEG's Quantizer
Quantization Matrix
JPEG's Compression Technique
Comparison of JPEG Compressed Images (Test Results)
References

Comments or Problems

Thank you for reading this JPEG tutorial. If you have any problems with this document, or would like more information, please send email to [email-masked].