Skip to content
Vizua
Support Vizua (coming soon)

Image Compression Explained: Lossy vs Lossless and When to Use Each

Vizua

Lossy compression removes image data your eyes won't miss, shrinking files by 60-80%. Lossless compression reorganizes data without removing anything, saving 20-50%. Every image format uses one or the other — and picking the right type for your images is the single biggest factor in file size.

What Happens to Your Pixels: The Core Difference

Imagine a photograph of a sunset. It contains millions of pixels, and many adjacent pixels are nearly identical shades of orange. Compression algorithms exploit this redundancy, but they do it in fundamentally different ways.

Lossless compression finds patterns in the pixel data and represents them more efficiently — like replacing "orange, orange, orange, orange" with "orange x4." When you decompress, every original pixel is restored exactly. The file is smaller, but no information was discarded. PNG and lossless WebP work this way.

Lossy compression goes further. It analyzes the image and decides which details the human visual system is least likely to notice, then discards them permanently. Subtle color gradients get simplified. Fine texture in shadow areas gets smoothed. The result is a file that is dramatically smaller — but the original data is gone forever. JPEG, lossy WebP, and AVIF all use this approach.

Neither method is universally "better." They solve different problems, and the best image workflows use both.

Lossy Compression: How It Actually Works

Lossy encoders like JPEG use a multi-step process:

  1. Color space conversion — the image is converted from RGB to YCbCr, separating brightness (which your eyes are sensitive to) from color information (which they are not).
  2. Chroma subsampling — the color channels are sampled at half or quarter resolution. Your eye barely notices because it resolves color at much lower precision than brightness.
  3. Block transformation — the image is divided into 8x8 pixel blocks, and each block is transformed using a mathematical operation (DCT for JPEG, prediction-based for WebP/AVIF) that separates important visual information from fine details.
  4. Quantization — this is where data is actually discarded. High-frequency details (subtle textures, noise) are rounded to zero. The "quality" slider in your image tool controls how aggressively this happens.
  5. Entropy coding — the remaining data is compressed losslessly to squeeze out any last redundancy.

The result: a 5 MB camera JPEG at quality 80 typically becomes a 500 KB-1 MB file with no visible quality difference at normal viewing sizes. That's an 80% reduction.

Lossless Compression: Preserving Every Pixel

Lossless encoders take a different approach. They don't discard any information — instead, they find more efficient ways to describe the same data:

  • Filtering/prediction — for each pixel, the encoder predicts its value based on neighboring pixels and stores only the difference. In smooth areas, these differences are tiny numbers that compress very well.
  • Dictionary coding — repeated patterns are stored once and referenced by a short pointer, similar to how ZIP compression works.
  • Entropy coding — frequent values get shorter binary representations, infrequent values get longer ones (Huffman coding or arithmetic coding).

The savings depend heavily on image content. A screenshot with large areas of identical color might compress 70-80%. A detailed photograph with unique textures in every region might only compress 10-20%. This is why lossless compression is ideal for graphics but impractical for web-scale photo delivery.

Real Numbers: File Size Comparison

Starting format Lossless output Lossy output (quality 80)
Uncompressed photo (5 MB) PNG: ~3.5 MB (30% savings) JPEG: ~500 KB (90% savings)
Screenshot (2 MB) PNG: ~400 KB (80% savings) JPEG: ~200 KB (90% savings, but text gets blurry)
Logo with transparency (500 KB) PNG: ~80 KB (84% savings) Not applicable (JPEG has no transparency)
JPEG photo (1 MB) recompressed PNG: ~2.5 MB (larger!) JPEG 80: ~700 KB (30% savings, generation loss)

Notice that last row. Converting a JPEG to PNG actually increases file size because lossless compression cannot efficiently represent the noise and artifacts that JPEG compression already introduced. This is a common mistake — PNG is not always smaller.

Which Formats Use Which Compression

Format Lossy Lossless Best for
JPEGYes (only)NoPhotos, hero images
PNGNoYes (only)Screenshots, logos, graphics with text
WebPYesYesBoth — web images of all types
AVIFYesYesBoth — maximum compression for modern browsers
GIFNoYes (limited)Simple animations (mostly replaced by WebP/AVIF)
TIFFOptionalYesArchival, print workflows

WebP and AVIF are the most versatile because they offer both modes. You get to choose per image: lossy for photos, lossless for graphics. If you're unsure which format to pick, our WebP vs AVIF comparison breaks down the tradeoffs.

Practical Guide: When to Use Each Type

Use lossy compression for:

  • Photographs and natural images (landscapes, portraits, product shots)
  • Website hero banners and background images
  • Social media images and thumbnails
  • Any image where a 60-80% file size reduction matters more than pixel-perfect accuracy

The optimal quality setting for most web photos is 75-85. At this range, the visual difference from the original is undetectable at normal viewing sizes, but the file is 60-80% smaller. You can test this yourself with Vizua's JPEG compressor or WebP compressor — both let you adjust quality and compare before/after.

Use lossless compression for:

  • Screenshots with text (lossy compression blurs text)
  • Logos and brand assets (exact color reproduction matters)
  • Technical diagrams and illustrations
  • Images with transparency (PNG or lossless WebP)
  • Archival copies you may need to edit later

For PNG files specifically, Vizua's PNG compressor optimizes the encoding and strips metadata to reduce file size without touching a single pixel.

Frequently Asked Questions

Can you tell the difference between lossy and lossless with your eyes?

At high quality settings (JPEG 80+, WebP 75+), most people cannot see any difference. Research using the SSIM metric shows that scores above 0.95 indicate perceptually identical images. The difference becomes visible only at aggressive compression levels (JPEG below 60) or when zooming to 200%+ on fine details like text or hair.

Is PNG always lossless?

Standard PNG is always lossless — every pixel is preserved exactly. However, some tools offer "lossy PNG" optimization by reducing the color palette from 16 million colors (24-bit) to 256 colors (8-bit). This is technically lossy, but for most screenshots and illustrations, the result looks identical to the human eye while cutting file size by 70-80%.

Which compression type is better for website images?

Lossy compression for photographs (JPEG, lossy WebP, AVIF) and lossless for graphics with text, sharp edges, or transparency (PNG, lossless WebP). The key metric is visual quality at the target display size — if a compressed photo looks identical at the size it will actually appear on screen, lossy is the right choice.

Does compressing an image multiple times make it worse?

For lossy formats, yes. Each round of lossy compression (save, re-open, save again) introduces additional quality loss called "generation loss." This is why photographers keep RAW or TIFF originals and only export to JPEG/WebP as a final step. Lossless formats do not have this problem — you can recompress a PNG any number of times with zero degradation.

Compress your images now

Lossy or lossless — free, private, runs in your browser.