How JPEG DCT Compression and Chroma Subsampling Work
A clear technical breakdown of YCbCr color conversion, 8×8 frequency blocks, quantization tables, and why text blurs in JPEG.
Primary Browser Tool
JPEG Compressor
Tune JPEG compression quality or fit a strict KB upload limit with live side-by-side artifact inspection.
Inside the JPEG Encoding Pipeline
Human retinas contain far more brightness-sensitive rod cells than color-sensitive cones. JPEG exploits this biology by converting RGB into Y (luminance) plus Cb and Cr (blue/red chrominance) channels, typically subsampling color resolution by half.
Next, the encoder divides the image into 8×8 pixel squares and applies the Discrete Cosine Transform (DCT), turning spatial brightness values into low-frequency averages and high-frequency edge coefficients.
| Stage | Operation | Visual Impact |
|---|---|---|
| 1. Color Space | RGB → YCbCr | Separates brightness detail from color detail |
| 2. Subsampling | 4:2:0 chroma reduction | Halves color bandwidth; can soften saturated red text |
| 3. 8×8 DCT | Frequency transformation | Concentrates energy into top-left block coefficients |
| 4. Quantization | Divides high frequencies | Main source of size savings and ringing/blockiness |
Practical Examples
Why Red Text Over Blue Looks Fuzzy in JPEG
Chroma subsampling merges 2×2 color pixels while keeping brightness sharp, creating color bleed around saturated text.
Common Mistakes & Honest Limitations
Mistakes to Avoid
- Using JPEG for crisp UI charts, wireframes, or red-on-black brand badges.
Technical Limitations
- HTML5 Canvas JPEG export uses standard browser libjpeg parameters and baseline encoding.