MY WEBCAM TEST GUIDE

What Is Lossy Image Compression and How Does It Work?

Learn what lossy image compression is, how formats like JPEG, WebP and AVIF shrink files by discarding detail, and when to choose lossy or lossless.

What lossy image compression means

Lossy image compression reduces file size by permanently discarding some image information. The encoder tries to remove detail that people are least likely to notice, so the result can look very close to the original while taking up much less storage. The removed data cannot be recovered. Decoding the file gives you an approximation of the original image, not an exact copy.

This is the key difference from lossless compression, which only stores the same pixels more efficiently and restores them exactly. JPEG is the best-known lossy format. WebP and AVIF can be saved in lossy mode, and WebP also has a separate lossless mode. PNG is a lossless format.

How lossy compression works

Exact steps depend on the file format and the encoder. JPEG is a useful example because its general process is well documented and many other codecs build on similar ideas.

  • Color conversion: the image is converted from RGB into a brightness channel and two color channels. Human vision is more sensitive to changes in brightness than to fine changes in color.
  • Chroma subsampling: the encoder can store color information at a lower resolution than brightness. Whether this happens depends on the encoder and its settings.
  • Block transform: the image is split into small blocks, and each block is converted from pixel values into frequency components that describe smooth areas and fine detail separately.
  • Quantization: high-frequency components, which carry fine texture and sharp detail, are rounded more coarsely or set to zero. This is the step where information is actually thrown away.
  • Entropy coding: the remaining values are packed with lossless coding, which shrinks the file further without additional loss.

Newer formats such as WebP and AVIF are derived from video codecs. They add techniques such as predicting a block from neighboring pixels and using flexible block sizes, but the core principle is the same: transform the image, quantize away less visible detail, then encode what remains.

The quality slider in an editor or export dialog mainly controls how aggressive quantization is. A number like 80 is not a percentage of retained data, and the same number can produce different file sizes and visual results in different applications or format versions. Judge the output by looking at it, not by the number alone.

Choosing when to use it

Lossy compression works best for photographs and other images with natural, continuous tones, such as camera photos, webcam snapshots and frames captured from video calls. Small errors blend into the noise and texture already present in these images.

  • Photos for websites, messages or email attachments: a lossy format is usually appropriate. Lower the quality setting gradually and stop when artifacts become visible at the size people will view the image.
  • Screenshots, text, user interface captures, diagrams and logos: prefer a lossless file format. Lossy encoding tends to create visible noise around sharp edges and lettering.
  • Images that need transparency: JPEG has no alpha channel. Use a format that supports it, such as PNG, or WebP or AVIF if the software and viewers you rely on support them.
  • Files you plan to edit again: keep an original or a lossless master, and export a lossy copy only as the final step.
  • Large files: if an image has far more pixel dimensions than it will be displayed at, resizing it often saves more space than lowering quality. Keep the aspect ratio locked while resizing to avoid stretching.

Before uploading or sharing compressed images, check what the receiving service does with them. Many platforms re-encode uploads with their own settings, and the handling of metadata such as location data varies, so verify those details for the specific service rather than assuming them.

Limits and common questions

Typical artifacts from strong compression include blocky squares in smooth areas, ringing or halos near sharp edges, banding in gradients such as skies, and smeared fine texture. Color edges can also look soft when chroma subsampling is used.

Repeatedly opening and re-saving a lossy file can add new errors each time, an effect known as generation loss. Converting a lossy file to a lossless format does not restore the lost detail; it only stops further loss from future saves.

Compression does not change pixel dimensions or aspect ratio by itself. A 1920 by 1080 photo stays 1920 by 1080 after lossy encoding; only the stored detail and file size change. If an app also reduces resolution during export, that is a separate resize step.

Is lossy compression always worse? Not in a practical sense. At sensible settings the difference from the original is often hard to see at normal viewing sizes, and the smaller file loads and transfers faster. The trade-off matters most when you need exact pixels, plan further editing, or work with text and graphics.