Four Formats: Compression Method Decides the Use Case
| Format | Compression | Alpha | Best for |
|---|---|---|---|
| PNG | Lossless (DEFLATE) | Yes, 8/24/32-bit | Icons, screenshots, text art, transparency |
| JPEG | Lossy (DCT) | No | Photos, gradients, backgrounds |
| WebP | Lossy or lossless | Yes | The general default |
| AVIF | Lossy or lossless | Yes | Maximum compression, progressive enhancement |
The distinction is one sentence: lossless (PNG, WebP lossless) restores every pixel and suits flat colour and line art; lossy (JPEG, WebP lossy) discards high-frequency detail the eye barely notices, shrinking a photograph to a tenth of its size at the cost of irreversible detail loss.
That also explains why PNG resists compression: the lossless algorithm is nearly useless on gradients and noise, so a photo saved as PNG often runs close to ten times the JPEG size. Pick the wrong format and every compression setting afterwards is wasted effort.
Selection: One Table, One Test
The test is a single question: does the image contain large areas of contiguous flat colour? Yes → PNG (or smaller still, SVG); no → JPEG, WebP or AVIF.
| Use | Recommended | Why |
|---|---|---|
| Website icons | SVG first, PNG fallback | Vector scales losslessly at any size |
| UI screenshots | PNG or lossless WebP | Text must stay crisp |
| Content photos | WebP with AVIF enhancement | Broad support plus best compression |
| Decorative backgrounds | JPEG or lossy WebP | No transparency needed |
| Images needing alpha | WebP or AVIF | The only formats combining alpha with real compression |
| Simple looping animation | Animated WebP | 30–50% smaller than GIF |
| Complex frame-by-frame animation | Keep GIF or use video | WebP inter-frame prediction fails |
| Desktop app icons | ICO | The Windows convention |
How far flat colour compresses: a 512x512 icon can be 3KB as PNG, while the same pixel count of photographic detail will barely move. The in-site image compressor applies this test to choose lossless or lossy.
Transparency and Animation: Two Costs
The cost of alpha. PNG in 8-bit mode offers only fully transparent or fully opaque; 32-bit RGBA adds partial alpha and a larger file. JPEG has no alpha channel at all — so a black background after converting a transparent PNG is not a bug, it is the format having nowhere to store alpha, leaving the tool to drop it or fill a solid colour. Keep PNG when transparency matters, or switch to WebP/AVIF; if you need compression without alpha, drop PNG to 8-bit indexed colour.
The cost of animation. Converting an animated GIF to WebP often makes it bigger, and inter-frame prediction is the reason: GIF applies LZW to a fixed palette with no differencing between frames, so size stays predictable; WebP's prediction works well on translation and fades, but fails when most of the frame changes and then stores whole frames. Measure before committing — simple loops (loaders, emoji) typically shrink 30–50%, while hand-drawn or particle animation should stay GIF or move to video. Trim dead frames with the GIF cropper.
Conversion and Size: Get It Right in One Pass
Lossy degradation is cumulative, so the whole flow is three steps:
- Keep a lossless master (PNG or the original);
- Convert once from the master at quality around 90;
- Do every resize, watermark and crop on the master, never on an already compressed copy.
The anti-pattern is JPEG → watermark → save JPEG → resize → save JPEG: four lossy steps, and the degradation becomes visible.
There is a quieter trap too: EXIF orientation can be dropped. A phone photo shot in portrait relies on the EXIF rotation tag to display upright, and some converters leave it lying down. Burn the rotation into pixels before processing and the result no longer depends on the toolchain.
Size works the same way: resize to the display size before compressing. If the slot is 400px wide and the source is 4000px, compressing the original wastes 90% of the pixels. Always resize to target, then convert and compress once — never outsource the downscale to the browser.
Reproducible Results
Export one screenshot as PNG, WebP and JPEG, then compare size and text edges: PNG is largest with the crispest text, WebP is clearly smaller with differences hard to see, and JPEG is smallest but shows ringing artefacts around glyphs. Then run the same phone photo through the image compressor: PNG barely moves while JPEG reaches a tenth of the size — direct evidence that format choice comes before compression settings.