PicSqueezer

Understanding Image Compression: Lossy vs Lossless Explained

18 August 2026 · 8 min read

"Compress this image" sounds like one operation. It isn't. There are two fundamentally different things a compressor can do, and knowing which one you're using explains almost every confusing result you've ever had — why a PNG barely shrinks, why a JPG looks worse each time you edit it, and why "reduce size without losing quality" is a slightly dishonest promise.

The core idea

An uncompressed image is just a list of pixels, each with a colour value. A 4000×3000 photo is 12 million pixels; at three bytes each that's about 36MB. Nobody ships 36MB photos, so every image format compresses that list somehow.

The two approaches differ in one respect: whether any information is thrown away.

Lossless compression: rewriting, not discarding

Lossless compression finds patterns and describes them more efficiently. Nothing is lost — decompress the file and you get back the exact original pixels, bit for bit.

The simplest version is run-length encoding. If a row of pixels reads "white, white, white, white, white", you can store "5× white" instead. Real formats use cleverer variations: PNG applies a filter that stores the difference between each pixel and its neighbour (in a smooth gradient those differences are tiny numbers, which compress beautifully), then runs the result through the same DEFLATE algorithm used by ZIP files.

This works brilliantly on images with structure and repetition: logos, icons, screenshots, charts, line art, anything with large areas of flat colour.

It works terribly on photographs. In a photo of leaves, every pixel differs slightly from its neighbour because of sensor noise and natural texture. There is almost no repetition to exploit, so a lossless compressor shrugs and gives you a file that's still enormous. This is why saving a photo as PNG can produce a file five to ten times larger than the JPG equivalent, with no visible benefit.

Lossless formats: PNG, GIF, lossless WEBP, and formats like TIFF and RAW used in professional photography.

Lossy compression: deciding what you won't miss

Lossy compression takes the opposite approach: it permanently deletes information, chosen specifically so that human eyes are least likely to notice.

JPEG, the most common example, exploits two facts about human vision:

  • We see brightness far more precisely than colour. So JPEG stores the brightness channel at full resolution and the colour channels at half resolution — a technique called chroma subsampling. Roughly half the colour data disappears immediately, and almost nobody can tell.
  • We notice large shapes more than fine texture. JPEG breaks the image into 8×8 pixel blocks and converts each into a set of frequency components — broad tonal shifts versus fine detail. It then keeps the broad ones accurately and rounds the fine ones off aggressively, often to zero.

That rounding step is where the quality setting lives, and where all the file size savings come from. A photo can lose 90% of its data this way and still look, at normal viewing size, essentially identical.

Lossy formats: JPG, lossy WEBP, AVIF, HEIC.

What the quality slider actually means

Here's a common misunderstanding: JPEG quality 80 does not mean "80% of the original quality". It's an index into how aggressively those frequency components get rounded off. The relationship between the number and both file size and visual quality is non-linear.

Practically:

  • 90–100 — near-indistinguishable from the original, but files get large fast. The jump from 90 to 100 can nearly double file size for a difference you cannot see.
  • 75–85 — the sweet spot for almost everything on the web. Substantially smaller, visually identical at normal viewing size.
  • 50–75 — usable when size matters more than perfection. Artefacts start appearing around sharp edges and in flat areas like skies.
  • Below 50 — visibly degraded. Blockiness, colour banding, halos around text.

The term for the 75–85 range is visually lossless: mathematically the data is gone, but a human comparing the two side by side can't reliably tell which is which.

Generation loss: the trap with lossy formats

Because lossy compression is destructive, it compounds. Open a JPG, crop it, save it — the image is re-analysed and re-rounded, losing a little more. Do that ten times and the degradation becomes obvious even at high quality settings.

Lossless formats don't have this problem. You can open and re-save a PNG a thousand times and the pixels never change.

The practical rule: keep your original — the RAW file, the full-size export, the layered design file — somewhere untouched, and treat compressed versions as disposable output. If you need to edit, go back to the original rather than editing the compressed copy.

"Compress without losing quality" — is it real?

Partly. Three things can genuinely shrink a file without touching visible quality:

  • Stripping metadata. Photos carry EXIF data — camera model, GPS coordinates, timestamps, sometimes an embedded thumbnail. Removing it can save tens of kilobytes and costs nothing visually. (It's also a privacy improvement, since GPS coordinates in a published photo tell people where you were.)
  • Better encoding of the same data. Modern encoders like MozJPEG produce smaller files than older ones at identical quality settings.
  • Switching to a more efficient format. Re-encoding a JPG as WEBP or AVIF at matched visual quality typically saves 25–50%.

Beyond that, if a tool promises dramatic size reduction with zero loss on a photograph, what it usually means is "loss you probably won't notice" — which is a reasonable thing to offer, just not the same claim.

The other lever: dimensions

Worth stating plainly, because it's often the real answer. Compression works on the data you give it. If you hand it a 4000-pixel-wide photo that will be displayed 800 pixels wide, no encoder can fix that inefficiency — you're asking it to compress data that shouldn't exist.

Halving an image's width and height quarters its pixel count, which typically cuts file size by around 70–75% before compression even starts. When you need a big reduction, resize first.

Choosing, in one paragraph

If the image is a photograph and it's going on the web or into an email, use lossy — JPG or WEBP at around 80% quality. If it has transparency, sharp text, or flat colour, use lossless — PNG or lossless WEBP. If you're archiving or plan to keep editing, keep a lossless master and export compressed copies as needed. And whichever you pick, get the dimensions right first.