What is lossy compression?
Lossy compression makes files much smaller by permanently discarding image detail people are least likely to notice, so the decoded image is close to, but not identical to, the original.
By Rocco Bombardieri · Updated
Want the full walkthrough? Read: WebP vs PNG for logos and graphics →
Explained in more detail
Lossy codecs exploit how human vision works. We are more sensitive to brightness than to fine color detail, and less sensitive to subtle variations in busy areas than in smooth ones. A lossy encoder throws away information in exactly those places, then compresses what remains.
JPEG is the classic example. Its lossy mode splits each image component into 8 by 8 sample blocks, transforms each block with a discrete cosine transform and quantizes the coefficients, which is where information is discarded. Encoders also commonly store color at a lower resolution than brightness. A quality setting controls how coarse the quantization is. Lossy WebP builds on the intra-frame coding of the VP8 video codec, which also uses a discrete cosine transform and quantization, and AVIF is based on the AV1 video codec.
Quality is a trade-off. Moderate settings can make a photo much smaller than its lossless version with differences most people cannot see. Push it too far and artifacts appear: blocky squares, ringing around sharp edges, and smeared color.
The loss is permanent and cumulative. Every time you open a lossy file, edit it and re-save it as lossy, you re-compress already degraded data and the errors compound. Keep an original in a lossless format and export a lossy copy only as the final step.
Lossy compression suits photographs. It is a poor fit for sharp-edged graphics such as logos and text, where artifacts are conspicuous. For those, use a lossless format or a lossless mode.
In Triim's converter, the quality slider applies to JPEG and WebP output; PNG output ignores it because PNG is lossless.