Image compression: what the quality slider actually changes
Resolution decides sharpness; quality decides how much colour detail and texture to throw away. Set the pixels first, then the quality.
NoUpload engineering teamLast updated
Key facts
- JPEG switches to half-resolution colour (4:2:0) below quality 90 and keeps full chroma resolution at 90 and above.
- PNG is lossless: the quality slider does nothing and byte targets are ignored, because the only way to hit them would be to lose pixels.
- AVIF quality is scaled by 0.65 before encoding, so a preset means approximately the same visual quality in every format.
- A byte target is found with six binary-search encodes, keeping the highest quality that fits.
Two images can show the same 1200-pixel-wide photo, one at 90 KB and one at 400 KB. The difference is not “resolution” in the marketing sense; both have the same pixels. It is how much of the colour and fine texture the encoder was allowed to approximate.
The image compressor exposes both decisions as separate controls. Understanding what each one does is the difference between a file that looks fine and one that looks like it was saved by a 2009 phone.
First, the resolution decision
Quality only matters after the pixel dimensions are right. A 4000-pixel photo compressed to 200 KB still costs more bytes than a 1600-pixel photo at the same visual sharpness, because the encoder is spending bits on detail the screen will never show.
For a card displayed at 380 CSS pixels on a 2× screen, 760 pixels is the useful target. For a full-width hero at a 1400-pixel container, 2100–2800 pixels covers 1.5× and 2× displays. The size targets guide works through the arithmetic; the resizer applies it in batches.
Compression does not resize by itself. Dropping a 12-megapixel photo into the compressor and choosing “Balanced” produces a 12-megapixel file at a lower quality — smaller, but still carrying four times the pixels a web page needs. Resize first, then compress, or use the resizer’s quality setting in the same pass.
What the slider means for each format
JPEG
Quality is a number from 1 to 100 passed to the encoder (mozjpeg here). Lower values quantise the frequency data more aggressively: flat areas survive, fine texture and colour transitions degrade first.
Two implementation details matter more than the number:
- Below 90, colour is stored at half resolution. JPEG keeps full detail in brightness and subsamples the two colour channels (4:2:0). Human vision is much more sensitive to brightness than colour, so this is usually invisible — but it is the first thing to show on saturated reds, thin coloured text and sharp colour edges.
- At 90 and above, colour stays at full resolution and trellis quantisation is enabled. That is a real step up in fidelity, and a real step up in bytes. This is why “Best quality” at 92 is noticeably heavier than 78, not just 14% heavier.
JPEG has no transparency. Anything transparent is flattened onto white before encoding.
WebP
WebP uses the same 1–100 quality scale but a different encoder and a better trade-off: at the same quality it is typically 25–35% smaller than JPEG, and it keeps transparency. The compressor uses method 4, which is a good speed/size balance, and keeps alpha at maximum quality.
For photographs on the web in 2026, WebP is the default answer. JPEG remains the right choice for email attachments and anything that might be opened by an old desktop application.
AVIF
AVIF is smaller again, but its quality scale is stricter: q50 in AVIF is roughly q85 in JPEG. The compressor compensates by scaling the number (×0.65) before handing it to the encoder, so “78” means approximately the same visual quality in every format.
The cost is time and a one-time download: the AVIF encoder is about 3 MB of WebAssembly and is fetched only when you choose AVIF. Encoding a large photo can take a few seconds.
PNG
The quality slider does nothing for PNG. PNG is a lossless format: there is no quality parameter to turn down. What the compressor does instead is re-encode the PNG and run it through oxipng, which removes redundant data and re-compresses the pixel stream without changing a single pixel.
That means:
- A PNG screenshot will get smaller, usually by 5–25%, with zero quality loss.
- A PNG export of a photograph will stay huge, because lossless pixels are expensive. Convert it to WebP or JPEG instead.
- A byte target (the 500 KB / 1 MB / 2 MB presets) is ignored for PNG, because the only way to hit it would be to lose pixels.
The presets, and when to use them
| Preset | Quality | Typical use |
|---|---|---|
| Smaller file | 55 | Thumbnails, avatars, images behind text |
| Balanced | 78 | Most web photos — the default for a reason |
| Best quality | 92 | Portfolio images, print preparation, anything zoomed |
55 is more usable than its reputation suggests, but it is a visible change on skin tones and gradients. 78 sits just below the chroma-subsampling threshold, which is the cheapest quality point that still looks normal at 1:1. 92 is for cases where someone will inspect the file, not just look at it.
Hitting an exact byte limit
The size presets exist for a mundane reason: the limit is usually an attachment cap, not a quality preference. Pick 2 MB, 1 MB or 500 KB and the compressor binary-searches quality in six steps — encode, compare, adjust — keeping the highest quality that fits. Six steps land within a few points, which is finer than the eye can resolve on a photograph.
Two honest caveats:
- The target can be missed. If even quality 1 does not fit, the result is quality 1 and the row says the target was missed. A 30-megapixel photo cannot always become 500 KB without resizing it.
- PNG ignores the target, as above.
If the file still does not fit, resize it rather than dropping quality further. Halving the long edge removes three-quarters of the pixels; dropping quality from 78 to 40 does not.
What else the round trip discards
Compression decodes the image to pixels and encodes it again. That has side effects worth knowing:
- Metadata is gone. EXIF, GPS coordinates, camera model and capture time are not copied. For sharing, that is a feature — the metadata guide explains what was in there.
- Colour profiles are gone. Wide-gamut and HDR photos are converted to sRGB during the canvas round trip. Colours may shift slightly, and HDR brightness is flattened.
- Animation is gone. An animated GIF or WebP becomes a single still frame.
- Every pass costs a generation. Recompressing an already-compressed JPEG at 78 again does not restore detail; it approximates the approximations. Keep the original and encode once at the size you need.
How to check the result
- Open the before/after comparison at 100%, not fit-to-window. Compression artefacts live at pixel level.
- Look at a gradient or a sky first. Banding appears there before anywhere else.
- Check text and sharp edges for coloured fringing — that is chroma subsampling at work.
- If the image has fine texture (hair, grass, fabric), compare that region. It is the second thing to go.
- Zoom out. If it looks identical at the size it will be displayed, the extra bytes are not buying anything.
The compressor runs entirely in the tab, in a worker per image. A hundred files is a queue, not an upload; nothing leaves the machine.
Questions this guide answers
What JPEG quality should I use for web images?
Around 78 for photographs: it sits just below the point where chroma subsampling kicks in, which is the cheapest setting that still looks normal at 1:1. Use 55 for thumbnails and 92 only when someone will inspect the file closely.
Why is my compressed PNG still large?
PNG is lossless, so compression can only remove redundant encoding, not pixels. A PNG of a photograph stays large by design; convert it to WebP or JPEG instead. PNG is the right format for screenshots, logos and text.
Does compressing an image remove EXIF and GPS data?
Yes. The image is decoded to pixels and re-encoded, so EXIF, GPS, camera data and the colour profile do not survive. That is usually desirable for sharing, but it also means the capture date and orientation tag are gone.