Overview
JPEG (commonly referred to as JPG due to the three-character file extension convention of early operating systems) is the most ubiquitous lossy image compression format in the world. Developed by the Joint Photographic Experts Group, a committee jointly established by the ISO and the IEC, JPEG excels at compressing photographic images by discarding visual information that the human eye is least likely to notice, achieving compression ratios of 10:1 or higher while maintaining acceptable visual quality.
The format works by transforming spatial pixel data into the frequency domain using the Discrete Cosine Transform (DCT), then quantizing the resulting coefficients to reduce precision in high-frequency components that represent fine details. This lossy process means that some image data is permanently discarded — each successive save at a lower quality setting introduces additional artifacts, particularly around sharp edges and in areas of flat color. Despite this trade-off, JPEG remains the dominant format for digital photography, web images, and social media because of its extraordinary compression efficiency for natural scenes.
JPEG files can embed EXIF metadata containing camera settings (aperture, shutter speed, ISO, focal length), GPS coordinates, timestamps, and thumbnail previews. This metadata is invaluable for photographers organizing large image libraries but raises privacy concerns when shared online without stripping location data.
History
The JPEG standard was first published in 1992 as ITU-T Recommendation T.81 and ISO/IEC 10918-1. The Joint Photographic Experts Group, formed in 1986, spent six years developing the compression algorithm through a rigorous process of proposals, testing, and refinement. The standard was revolutionary at the time — it made it practical to store photographic-quality images in files small enough to transmit over early internet connections and store on limited hard drives.
The JPEG File Interchange Format (JFIF), published by Eric Hamilton at C-Cube Microsystems in 1992, defined the common container structure used today. The Exchangeable Image File Format (EXIF), developed by the Japan Electronic Industries Development Association (JEIDA) in 1995, added metadata support for digital cameras. A newer variant, JPEG 2000 (ISO 15444), was standardized in 2000 with wavelet-based compression offering better quality at low bitrates, but it failed to achieve widespread adoption due to licensing concerns and lack of browser support.
Technical Details
JPEG compression operates in several stages. First, the image is converted from RGB to YCbCr color space, separating luminance (Y) from chrominance (Cb, Cr). Chrominance channels are typically downsampled (most commonly 4:2:0, reducing chrominance resolution by half in each dimension) because the human visual system is more sensitive to brightness than color. The image is then divided into 8x8 pixel blocks, and each block undergoes a Discrete Cosine Transform that converts spatial data into 64 frequency coefficients.
A quantization matrix (scaled by the quality setting) divides each coefficient and rounds the result to an integer, zeroing out many high-frequency components. The quantized coefficients are then zigzag-scanned, run-length encoded, and Huffman-coded (or arithmetic-coded in less common implementations) to produce the final compressed bitstream. Baseline JPEG supports 8-bit color depth per channel (24-bit color), while JPEG extensions support 12-bit depth. The maximum image dimensions are 65535 x 65535 pixels.
Pros & Cons
Pros
- Exceptional compression ratios for photographic content (10:1 to 20:1 with good quality)
- Universal support across every browser, operating system, camera, and image editor
- Adjustable quality parameter allows fine-tuning the size/quality trade-off
- EXIF metadata support for camera settings, GPS, and organizational data
- Mature, royalty-free standard with three decades of ecosystem investment
Cons
- Lossy compression permanently discards image data with each save
- Visible blocking artifacts at low quality settings, especially on sharp edges
- No transparency support — fully opaque images only
- Not suitable for text, line art, or graphics with sharp color boundaries
- Repeated editing and saving causes cumulative quality degradation (generation loss)
Common Use Cases
- Storing photographs from digital cameras and smartphones
- Displaying photographic content on websites and social media platforms
- Embedding images in documents, presentations, and email messages
- Printing photographs at photo labs and consumer printers
- Transmitting medical images in DICOM-wrapped JPEG for teleradiology
- Archiving digitized historical photographs and artwork scans