Image Compressor & Resizer

Shrink image file size in your browser: set a maximum dimension and quality, see before/after sizes instantly. Nothing is uploaded.

1,181 views

How Compression Actually Shrinks a File

Two fundamentally different approaches shrink an image, and confusing them explains most compression surprises. Lossless compression, the approach PNG uses via the deflate algorithm, rearranges and packs data more efficiently without discarding a single pixel — decompress it and the exact original comes back, bit for bit. Lossy compression, the approach JPEG uses, instead throws away information the human eye is least likely to notice: it splits the image into 8×8 blocks, runs a DCT (discrete cosine transform) on each block to separate coarse detail from fine detail, then quantizes — rounds off — the fine, high-frequency detail more aggressively the lower the quality slider is set. That rounding is not reversible, which is why a JPEG re-saved at low quality repeatedly degrades a little more each time.

Push the JPEG quality slider too low and the 8×8 block boundaries used by the DCT step become visible as "block artifacts" — a mosaic-like blockiness, especially in smooth gradients like skies. A second lossy technique, chroma subsampling (commonly labeled 4:2:0), throws away color resolution while keeping brightness resolution intact, because the human eye is far more sensitive to changes in brightness (luminance) than to changes in color (chrominance) — this alone typically halves the color data with almost no visible loss, on top of whatever the quality slider does.

Concrete example: a 4000×3000 phone photo, resized to 1600 px wide, drops to roughly 16% of its original pixel count before compression quality is even touched — dimensions dominate the file-size equation more than quality does. Add a JPEG quality of 75-85% (visually close to indistinguishable from 100% for most viewers) and a typical 6 MB photo lands under 300 KB, easily small enough for web pages, forms and email attachments.

Everything in this tool runs on a canvas inside the browser — the photo is never uploaded anywhere. It preserves aspect ratio, never upscales beyond the original, and shows the old-to-new size per file so the trade-off can be judged before saving.

Things Worth Knowing

  • The quality slider only touches lossy formats (JPEG/WebP) — a PNG screenshot barely shrinks from quality alone, because the PNG deflate step is lossless by design; the dimension cap does almost all the work there.
  • Removed pixel data does not come back once compressed — always keep the original file and export compressed copies per use case, rather than repeatedly recompressing an already-compressed file.
  • Chroma subsampling (4:2:0) and quality quantization are independent levers — an encoder can apply heavy subsampling at high quality or none at low quality, which is why two files at the same "quality number" from different encoders can look different.
  • WebP typically beats JPEG at equivalent visual quality because it uses more modern prediction and transform techniques, but JPEG remains the safest choice for maximum compatibility.

Frequently Asked Questions

What is the real difference between lossy and lossless compression?

Lossless compression (PNG) repacks data with no information discarded - decompressing returns the exact original. Lossy compression (JPEG) permanently discards high-frequency detail the eye barely notices, using a DCT transform and a quantization step, so some information is gone for good once compressed.

Why do I see blocky artifacts at low JPEG quality?

JPEG compresses in 8x8 pixel blocks via the DCT transform; at low quality settings the rounding within each block becomes coarse enough that the block boundaries themselves become visible, producing the mosaic-like "block artifacts" most visible in smooth areas like skies.

What is chroma subsampling and why does it help?

It is the practice of storing less color detail than brightness detail - commonly as 4:2:0, meaning color is sampled at quarter resolution. It works because human vision is far more sensitive to brightness than to color, so the loss is nearly invisible while the file shrinks meaningfully.

What settings should I use for a website?

Content images: 1600-2000 px on the long edge, JPG/WebP at 75-82% quality. Thumbnails: 400-800 px. Full-screen hero images: up to 2560 px, with quality closer to 70 to compensate for the larger canvas.

Why did my PNG barely shrink?

The quality slider only affects lossy formats; PNG uses lossless deflate compression, so the dimension cap does almost all the size reduction for a PNG file. Converting to WebP or JPEG, when transparency is not needed, gives a much bigger drop.

Comments

No comments yet — be the first to write one!

Similar Tools