Image Compression Settings Explained
Compression settings decide how much an image gives up for a smaller file. This guide explains what the quality number, PNG colour reduction and a target file size actually do.
Lossless and Lossy Compression
Lossless compression stores the pixels more compactly and gives back exactly the same values when the image is opened. PNG is lossless, and WebP has a lossless mode. The savings come from repetition: flat areas and repeated patterns compress well, photos and noisy images poorly.
Lossy compression, used by JPG and usually by WebP, discards information people are less likely to notice. JPG, for example, splits the image into blocks of 8 × 8 pixels and stores their fine detail with less precision; colour is often stored at a lower resolution than brightness. What is discarded cannot be restored.
What the Quality Number Means
The quality number, usually from 1 to 100, is an encoder setting that controls how coarsely detail is stored. It is not a percentage of the original file size or of the original quality: a JPG saved at 50 is not half the size of one saved at 100. The same number also differs between programs and formats: WebP at 75 is not JPG at 75.
File size does not fall evenly as the number drops. The highest settings cost much more space for differences that are hard to see, while the lowest settings save comparatively little extra and add obvious artefacts:
- Blocking: visible squares in JPG, especially in skies and other smooth areas.
- Ringing: halos and speckles around sharp edges and text.
- Smearing: fine texture such as grass or hair turns flat, a typical look of low-quality WebP.
- Banding: smooth gradients split into visible steps.
Judge the result at actual size on the parts that matter, such as faces, text and gradients. The LeedyBox compressor starts at 75 and shows the original and the result side by side.
PNG Colour Reduction and Banding
Because PNG is lossless, the main way to make a PNG much smaller is to reduce its colours first (colour quantisation). The image is mapped to a palette of at most 256 colours, and each pixel then stores a palette index of one byte or less instead of three or four bytes. Palette entries can be partly transparent, so transparency is kept.
This works well for screenshots, logos, charts and diagrams, which use few colours. Photos and smooth gradients such as skies or soft shadows contain thousands of shades; mapped to a small palette, a gradient turns into visible bands. LeedyBox does not apply dithering, which some tools use to hide banding at the cost of grain and larger files.
In LeedyBox, the quality slider sets the largest PNG palette: 256 colours at 99, about 130 at the default of 75, and 16 at 1. At 100 the colours are not reduced and the PNG is only re-compressed. For photos, JPG or WebP usually give a smaller file with less visible damage.
How a Target File Size Is Reached
For upload forms with a size limit, the "Target file size" mode searches for settings for you:
- For JPG and WebP it tries quality 95 first. If that is too large, it narrows the range between 5 and 95 by repeated halving and keeps the highest quality it finds that fits.
- For PNG it tries the lossless version, then 256, 128, 64, 32 and 16 colours.
- If nothing fits and reducing the dimensions is allowed, it shrinks each side by at least 10 %, based on the last result, and searches again, down to 10 % of the original width and height.
Because quality is lowered before the dimensions, a small target can produce a full-size image at a very low quality. If you know the display size, also set "Also limit the width and height", so the size budget is not spent on pixels nobody will see. The result is usually a little below the target. LeedyBox counts 1 KB as 1,024 bytes; some websites mean 1,000 bytes, so leave a margin. If the target cannot be reached, you get the smallest result and a warning.
When Compression Does Not Help
An image already saved at a moderate quality has little left to remove. Re-encoding it may save almost nothing or even produce a larger file, and every lossy encoding adds new errors on top of the old ones, so a JPG that is edited and saved again and again keeps losing detail. Keep the original, compress from it each time, and compress last, after cropping and resizing.
Format changes have pitfalls too: a JPG photo saved as PNG often gets larger, and a screenshot saved as JPG may shrink but shows ringing around the text. When a result is not smaller than the original, the LeedyBox compressor selects the original for download; you can switch to the compressed file for each image.
Side Effects: Metadata and Transparency
The LeedyBox compressor draws each image in the browser and encodes a new file, so EXIF data, GPS location, camera details, copyright fields and colour profiles are not carried over. That can help privacy, but check whether you need author or copyright information. Images with a wide-gamut colour profile can look slightly different afterwards. The camera orientation is applied to the pixels, so photos stay upright.
JPG has no transparency: transparent areas become white, and soft edges are blended with white, which shows as a light fringe on a dark background. Keep PNG or WebP for logos and cut-outs; see why transparent PNGs lose transparency in JPG.
Frequently Asked Questions
What quality setting should I use for photos?
Start with 75 and compare at actual size. Raise it if you see blocks or smearing in important areas; lower it in small steps if the file must be smaller and the image still looks fine.
Is WebP smaller than JPG?
Often at a similar visible quality, but not for every image. Compare both, and check that the place where you publish accepts WebP.
Should I resize or compress first?
Resize first if the image is larger than it will be displayed; the compressor's "Also limit the width and height" option does both in one step. See also the Image Resizer and the guide Resizing Images: Pixels, Aspect Ratio and DPI.