Lossy Compression
A compression method that discards imperceptible data for high compression ratios. Cannot restore originals.
Lossy compression irreversibly removes data to significantly reduce file size. The original cannot be reconstructed, but it discards information starting with what is hardest for people to perceive, keeping quality that is adequate for many uses while cutting size substantially. Whether the difference is noticeable depends on the image and the viewing conditions - smooth gradients and text degrade visibly sooner.
Key techniques for images:
- Transform coding: DCT or DWT converts spatial data to frequency domain, quantizing less perceptible high-frequency components. JPEG uses DCT; JPEG 2000 uses DWT
- Predictive coding: Encodes only residuals between predicted and actual values. Used in WebP and AVIF to remove spatial correlation. It is not exclusive of transform coding: in WebP (VP8) the residual from block prediction is then passed through a DCT, so real formats combine the two
- Chroma subsampling: Exploits lower sensitivity to color vs luminance. At 4:2:0, chroma resolution is 1/4 of luminance
The main advantage is the compression ratio - JPEG at quality 80 often brings a file down to a fraction of its original size, but how much depends on subject detail, noise and the encoder implementation, so measure it on representative images. For web delivery this improves page speed and saves bandwidth, which helps UX; where load speed feeds into evaluation it can help SEO as well.
The trade-off is generation loss - re-compressing causes cumulative degradation. In practice, work is therefore kept in lossless formats (PNG, TIFF) during editing and lossy compression is applied only at final output. Quality parameters are scaled independently per format, so do not carry a number from one format to another - compare on the target image and decide per use case.