PandaCompress Logo PandaCompress
Compress Guide · Deep Dive

How Does Compression Turn a 2MB Photo into 126KB?

A photo straight from your phone is easily over 2MB, yet 126KB is plenty for the web. Using real benchmark data from the pandac engine, this guide explains compression principles, format choices and quality settings in one pass — afterwards you will know exactly how to compress any given image.

Updated Oct 1, 2026 8 min read Data from real pandac engine tests

01 · Benchmarks: One Photo, Four Formats

PNG Original
2.05MB
Baseline · 100%
PNG Lossless
587KB
-72% · pixel-identical
WebP Q80
242KB
-88.5% · visually identical
Just 1/16 the size
AVIF Q60
126KB
-94% · best for the web
PNG PNG lossless-check · lossless path -72%
Before · 2.05MB
Original landscape photo before compression
After · 587KB
Losslessly compressed landscape, pixel-identical to the original

The lossless output is pixel-identical to the original (SSIM = 1.0000) — only the data layout changes.

PNG WebP web-delivery · lossy path -88.5%
Before · 2.05MB
Original landscape photo before compression
After · 242KB
Lossy WebP compressed landscape, visually indistinguishable

The lossy output only shows faint texture differences at 100% zoom side-by-side; invisible in normal viewing.

T

pandac engine benchmark table

Output Config Before → After Saved Time
photo-alps.png PNG · lossless · re-compressed 2.05 MB → 587 KB -72% 412 ms
photo-alps.webp WebP · Q80 · smart lossy 2.05 MB → 242 KB -88.5% 368 ms
photo-alps.avif BEST AVIF · Q60 · perceptual 2.05 MB → 126 KB -94% 1.24 s
Test environment: Chrome 140 · M2 · pandac v3.2 engine; timing covers full decode + encode.

02 · How It Works: What Redundancy Hides Inside an Image?

A photo can shrink to a tenth of its size because raw pixel data carries huge amounts of information the human eye never needs. Encoders attack it from two directions:

Spatial Redundancy → Predictive Coding

Spatial Redundancy

In large flat areas like sky or walls, neighboring pixels are nearly identical. Instead of recording every pixel, the encoder lets each block predict from its neighbors and writes only the difference — which is usually near zero and compresses extremely well.

Residual ≈ 0 Neighbor reference → record only the diff

Perceptual Redundancy → Chroma Subsampling & Quantization

Perceptual Redundancy

The eye is sensitive to brightness but sluggish about color detail. Encoders store chroma at half resolution via 2×2 subsampling, then quantize high-frequency texture away — dropping detail the eye never misses. That is why lossy compression saves so much size at so little quality cost.

Quantization threshold: discard to the right Energy concentrates in low frequencies (left) → fine detail (right) is dropped first

03 · Lossy vs Lossless: Ask "Who Is This Image For?"

Lossless Compression

Like zipping a file · unzips bit-for-bit identical
LOSSLESS

Every pixel is identical — the decompressed file matches the original exactly. It works by reorganizing data (better entropy coding, stripping redundant metadata) without discarding any pixel information.

Best for
Screenshots · design files · transparent PNGs
Typical savings
10% ~ 40%
Recommended for photos

Lossy Compression

Like WAV to MP3 · you cannot hear the difference
LOSSY

Deliberately discards information the eye barely notices (quantization, chroma subsampling) for dramatic size cuts; at sensible quality settings the result is visually indistinguishable from the original.

Best for
Photos · social images · web hero visuals
Typical savings
70% ~ 95%

Rule of thumb: choose lossless for archiving or re-editing; choose lossy for publishing or sharing. When in doubt, use "Auto" — pandac decides based on image content.

04 · Four Formats: One Pipeline, Four Generations

P

The modern image encoding pipeline

Pixel blocks
8×8 / 16×16 tiling
Predict / transform
DCT / directional intra prediction
Quantize
Q factor sets how much is dropped
Entropy coding
Huffman → arithmetic coding
Transform coding

Moves pixel blocks into the frequency domain, concentrating energy into a few coefficients.

Rate-distortion optimization

Picks the optimal coding path per block, balancing size against distortion.

Arithmetic entropy coding

Assigns bits by symbol probability, saving another 5–10% over Huffman.

Intra prediction

References neighboring blocks along edge directions, recording only residuals — flat areas cost almost nothing.

Loop filtering

Smooths block boundaries after coding, removing blockiness so low Q values still look good.

Chroma subsampling

Halves chroma resolution, exploiting the eye's insensitivity to color detail.

JPG 1992
The veteran · compatibility king

8×8 DCT + Huffman. Three decades of universal compatibility remain unbeatable; no alpha support, and heavy compression shows blocking artifacts.

Recommended for
Legacy systems needing max compatibility · email attachments
PNG 1996
Lossless · transparency expert

DEFLATE entropy coding + per-row filter prediction. Native alpha transparency and palette color; bulky for photos, excellent for flat graphics.

Recommended for
Logos · UI assets · anything needing transparency
BALANCED
WebP 2010
The all-rounder · modern default

VP8 keyframe framework: intra prediction + arithmetic coding, 25–35% smaller than JPG at equal quality; dual lossy/lossless modes with alpha and animation.

Recommended for
Web content · social sharing · general purpose
NEXT-GEN
AVIF 2019
The newcomer · smallest size

AV1 intra coding: up to 81 prediction directions + large variable blocks + loop filtering, roughly 30% smaller than WebP at equal quality; slower to encode.

Recommended for
Modern blogs · web app hero visuals
X

Four engineering tricks inside the pandac engine

mmap zero-copy

Reads files via memory mapping, skipping repeated copies — large images load faster.

XXH3 hashing

Ultra-fast content fingerprints for deduplication and integrity checks.

Zero-decode metadata

EXIF/ICC metadata is handled on the side and stripped without decoding pixels.

128-bit perceptual fingerprint

Perceptual hashing picks quality tiers, avoiding recompression and wasted quality.

Format Born Lossy / lossless Alpha Size at same quality Compatibility One-line summary
JPG 1992 Mostly lossy ✗ Baseline 100% 100% The universal photo format with maximum compatibility
PNG 1996 Lossless only ✓ Large for photos 100% The standard for transparency and flat graphics
WebP 2010 Both modes ✓ ≈ 65–75% ≈ 95% The balanced choice for the modern web
AVIF 2019 Lossy + lossless ✓ ≈ 45–55% ≈ 85% The next-gen format chasing the smallest size

05 · The Quality Factor: Choosing Q Without Regret

Quality range Best for Visual result Size feel
Q30 ~ 50 Thumbnails · list covers Acceptable at small sizes, blurry when enlarged Tiny
Q60 ~ 75 Social sharing · chat images No visible difference in normal viewing Small
Q75 ~ 85 RECOMMENDED Web hero visuals · blog images The golden balance of quality and size Balanced
Q85 ~ 95 Portfolios · e-commerce detail pages Near-lossless look for demanding use Medium
Lossless Screenshot archiving · re-editable assets Pixel-perfect identical Larger

Rule of thumb: Q80 + WebP works for most images; only images that will be viewed zoomed-in (portfolios, product close-ups) need Q90+. Dropping from Q95 to Q80 usually halves the size again with barely any visible change — do not pay for sharpness nobody will see. AVIF at Q60 already matches WebP Q80 visually, so you can push it further.

06 · FAQ

Will compression visibly degrade quality?

At the recommended settings (WebP Q80 / AVIF Q60) there is no visible difference in normal viewing; only a 100% zoom side-by-side reveals faint texture changes. Lossless mode guarantees SSIM = 1.0000 — pixel-identical.

Which output format should I pick?

Quick guide: transparency/archiving → lossless PNG; compatibility → JPG; balance → WebP; smallest size → AVIF. When in doubt, pick "Auto" — pandac chooses the best format from content and alpha channel.

Is a higher quality (Q) value always better?

No. The quality gap between Q95 and Q80 is far smaller than the size gap — the closer to 100, the less quality each extra byte buys. Q75–85 is the widely accepted sweet spot for the web; treat Q as a reference and trust your own eyes at 100% zoom.

Do my images stay on the server?

Never. Compression runs entirely in your browser — nothing is uploaded, everything is cleaned up when you close the page, and it even works offline.

PandaCompress Logo
Ready to compress?

Try PandaCompress now

No sign-up, no uploads — drop a photo in and see how many KB it can shed.