Image Formats

The Complete Guide to JPEG Format

JPEG is the most widely used image format in the world. From its creation in 1992 to compression principles and optimal quality settings, learn everything there is to know about JPEG.

Overview

JPEG (Joint Photographic Experts Group) is a lossy compression format optimized for photographs and natural images. Since its standardization as ISO/IEC 10918-1 in 1992, it has been used across virtually every digital imaging domain including the web, mobile devices, and print.

The file extension is .jpg or .jpeg, and its MIME type is image/jpeg. It supports 24-bit true color (approximately 16.77 million colors), enabling rich and accurate color reproduction for photographs.

History

JPEG development began in 1986 when ISO and ITU-T (formerly CCITT) jointly formed the Joint Photographic Experts Group committee. Here are the key milestones:

  • 1992 — First standard published as ISO/IEC 10918-1. DCT-based lossy compression method finalized.
  • 1994 — JFIF (JPEG File Interchange Format) version 1.02 released. Established as the file interchange standard.
  • 1997 — Exif (Exchangeable Image File Format) introduced. Became the standard for digital camera metadata.
  • 2000 — JPEG 2000 (ISO 15444-1) released. Wavelet-based but limited adoption due to compatibility issues.
  • 2017 — Still accounted for approximately 73% of web images, maintaining its dominance as the leading format.

How Compression Works

JPEG compression exploits the fact that human vision is sensitive to changes in brightness but relatively insensitive to changes in color. The process can be broken down into four stages.

1. Color Space Transform (RGB to YCbCr)

The original RGB image is converted to the YCbCr color space. It is separated into Y (luminance), Cb (blue chrominance), and Cr (red chrominance), and then the chrominance channels (Cb, Cr) are subsampled (typically 4:2:0) to reduce data.

4:2:0 subsampling reduces chrominance information by half in both horizontal and vertical directions. Since the human eye is far more sensitive to brightness than color, the visual quality loss from this process is nearly imperceptible.

2. DCT (Discrete Cosine Transform)

The image is divided into 8x8 pixel blocks, and a two-dimensional DCT (Discrete Cosine Transform) is applied to each block. This process transforms pixel values from the spatial domain into frequency domain coefficients.

  • DC coefficient (top-left): Represents the average brightness of the block.
  • AC coefficients (remaining): Represent the detail patterns (high-frequency components) within the block.

In natural images, most energy is concentrated in low frequencies (DC and low-frequency AC), so removing high-frequency coefficients has minimal visual impact.

3. Quantization

DCT coefficients are divided by values in a quantization table and then rounded. This is the stage where information is actually discarded, and it is the core reason why JPEG is a lossy format.

Higher quality settings use smaller divisors in the quantization table, preserving more detail, while lower settings discard more aggressively to reduce file size.

Quantization is irreversible. Once information is discarded, it cannot be recovered. Repeatedly editing and saving a JPEG causes quality degradation with each generation (generation loss).

4. Entropy Coding

The quantized coefficients are compressed using Huffman coding or arithmetic coding. This stage is lossless and reduces the final file size by removing statistical redundancy in the data.

  • Zigzag scan: Reads the coefficients of each 8x8 block from low to high frequency, arranging consecutive zeros together.
  • RLE (Run-Length Encoding): Efficiently encodes consecutive zeros.
  • Huffman coding: Assigns shorter codes to more frequently occurring values.

Progressive vs Baseline

JPEG supports two encoding modes.

Feature Baseline Progressive
Loading method Top to bottom, line by line Entire image gradually sharpens
File size Slightly larger Typically 2-10% smaller
Memory usage Low (processes line by line) Higher (requires full image buffer)
Perceived speed Incomplete display on slow connections Full outline visible quickly
Recommended use Embedded systems, resource-constrained environments Web pages, large photos

For web images, progressive JPEG is recommended. Not only is the file size slightly smaller, but users can perceive the entire image quickly, improving the perceived loading speed.

Quality Settings

The JPEG encoder's quality parameter (1-100) controls the aggressiveness of the quantization table. An important point is that this number is not an absolute quality metric.

  • 100: Minimal quantization. Very large file size, nearly indistinguishable from the original. Generally unnecessary.
  • 85-92: Optimal range. Best balance between file size and quality. Suitable for both web and print.
  • 70-84: Slight degradation may be visible to the naked eye. Use when file size reduction is a priority.
  • Below 50: Noticeable artifacts appear (blocking, ringing). Suitable only for thumbnails or previews.

Practical advice: In most cases, quality 85-90 is sufficient. Going above 92 dramatically increases file size with virtually no visible difference.

Pros & Cons

Pros

  • Universal compatibility: Supported by every browser, OS, image viewer, and editing software.
  • High compression ratio: Photos can be compressed 10-20x compared to the original.
  • Adjustable: Fine-grained control over the quality-size tradeoff.
  • Exif metadata: Rich metadata support including camera info, GPS, and shooting settings.

Cons

  • No transparency: No alpha channel support. Use PNG or WebP if you need transparent backgrounds.
  • Generation loss: Quality degrades with each re-encoding.
  • Poor with text and lines: Blocking artifacts appear at sharp edges.
  • No animation: Only static images are supported.
  • Limited color depth: Only 8 bits per channel (24-bit true color). No HDR support.

Use Cases

  • Digital photography: The default capture format for cameras and smartphones.
  • Web images: Banners, product photos, blog images, and more.
  • Social media: Most platforms including Instagram and Facebook use JPEG as their default format.
  • Print: With adequate quality (95+) and resolution (300 DPI), JPEG is suitable for print.
  • E-ink wallpapers: Converting to grayscale and saving as JPEG maximizes compatibility with E-ink devices.

Format Comparison

Feature JPEG WebP AVIF
Compression method DCT (lossy) VP8/Lossless (lossy + lossless) AV1 (lossy + lossless)
Transparency Not supported Supported Supported
Animation Not supported Supported Supported
File size (same quality) Baseline 25-34% smaller Up to 50% smaller
Browser support 100% 97%+ 92%+
Editing software All software Most supported Limited
Encoding speed Fast Moderate Slow

CropCrop Tips

  • Export format: After editing your image in CropCrop, select JPEG in the export settings. It is the optimal choice for photographs.
  • Quality slider: A default of 90 is recommended. For grayscale E-ink wallpapers, 85 is sufficient.
  • E-ink optimization: Applying a grayscale filter and then exporting as JPEG results in smaller file sizes. JPEG is the most compatible format for E-ink devices.
  • Need a transparent background? Choose WebP or PNG instead of JPEG.

CropCrop processes images on the client side, so your original images are never sent to a server. You can edit even privacy-sensitive photos with peace of mind.