Format
The codec decides what is even possible. JPEG cannot store transparency; PNG cannot offer a quality dial; AVIF buys the smallest files with the slowest encode.
Every image format in common use spends bits the same three ways. Learn the levers once and you stop guessing at quality sliders — and stop shipping megabytes you did not need.
An encoder is not a file zipper. It rewrites the picture in a form where detail the visual system barely notices costs almost nothing.
Lossless and lossy compression both exploit redundancy. Lossless encoders find patterns a decoder can reverse exactly: repeated pixel runs, predictable neighbouring values, repeated byte sequences. Lossy encoders go further and discard information outright — usually coefficients too small to see, and colour detail the eye resolves poorly.
The practical difference is not quality, it is guarantees. Lossless output is bit-identical to the input, forever. Lossy output is an approximation, and once discarded the detail is gone: re-encoding a lossy file at higher quality does not restore it, it just stops making things worse.
A photograph is smooth: neighbouring pixels are similar, so a frequency transform concentrates almost all the energy into a few coefficients. A screenshot of black text on white is the opposite — every glyph edge is a sharp discontinuity, and sharp edges need coefficients. That is why the same codec that halves a holiday photo will balloon a UI capture into a blurry mess, and why PNG exists at all.
This is also the single fact that makes format choice useful: match the codec to the content, not to a preference.
Format, quality and pixel dimensions. Every other control in a compressor is a convenience wrapper around one of these.
Order matters. Spending quality before fixing resolution is the most common way to ruin an image and still ship it too large.
Savings depend far more on content and format than on the tool you use. These are the ranges we measured over 1002 Wikimedia images with real vips at quality 85 balanced.
The full method, per-file numbers and the caveats live on the benchmarks page. Read it before quoting any percentage as a promise — your folder is not our folder.
Push quality down and artefacts arrive in a predictable sequence. Recognising the stage tells you which lever you spent wrongly.
Colour is subsampled before anything else. Thin red type on white starts to fringe and saturated edges lose their edge colour.
Smooth skies and gradients collapse into visible steps, because quantisation rounds similar coefficients to the same value.
Sharp edges — text, window frames — grow a halo of faint ripples as truncated high frequencies stop cancelling.
The 8×8 grid becomes visible as a checkerboard. At this point the file is small because the picture is gone.
If you see blocking on a photograph, you are past the useful range. Resize instead of compressing harder.
A four-line decision covers almost every case. The rest of this site explains each branch in depth.
The capability matrix — compression type, alpha, animation and support — is in image formats compared.
If the requirement is a number — 100KB, 200KB, a CMS cap — spend the cheap levers first.
If the constraint is "without losing quality", start with the near-lossless path instead — it is a different tradeoff, not a stricter setting.
No. JPEG at quality 100 still quantises — it just uses a finer table. The file grows enormously for detail no display will show. If you need exact pixels, the format has to be lossless.
Re-encoding at a lower quality does compound damage, but re-encoding at the same setting mostly wastes a generation for little gain. Compress once, from the original, and keep the original.
PNG is lossless, which is not the same as better. For a photograph, a well-encoded JPEG is visually indistinguishable and a fraction of the size. PNG wins on sharp edges and transparency, not on photographs.
DPI is a print metadata field. It changes the physical size an image prints at, not the pixels it contains. Upscaling to "300 DPI" invents nothing.
Downscaled previews hide blocking and ringing. Judge at 100% and on the size it will actually ship at — those are different tests.
The pipeline every lossy codec shares: transform, quantise, entropy-code. The mechanism →
What each guarantees, and what "perceptually lossless" is allowed to mean. Compare →
Apply the recipe to a whole folder, offline, with per-file results. Compress an image →
Quality, format and resize in one pass, with before/after numbers on every file.