When a soft-edged transparent PNG gets squeezed into 64 colours, does turning dithering on fix the edge? On the feathered sample below it did not: the edge error stayed almost where it was and the file came out 3.5 times larger. Every number here is tagged measured, inference or not tested, so you can see which is which.

The samples and the yardstick

Three transparent PNGs, all generated by a script, all 800×800, all fictional. A feathered orange-to-purple circle (126,939 B, 230,502 semi-transparent pixels), a rounded card with a drop shadow (28,596 B) and a triangle logo with a 1 px anti-aliased edge (58,744 B). Generated art has a lot of flat colour, so it compresses more easily than a real design file. Read the percentages as relative.

The tool is pngquant 3.0.3, one run per setting on one Apple-silicon Mac (measured). The error metric is the mean edge alpha error on a 0–255 scale, counted only over pixels that were semi-transparent in the original (measured definition).

Edge error follows the colour count

Feathered sample, dithering on versus off (all measured):

Colours Dither Size (B) Edge alpha error
256 on 43,434 1.27
256 off 26,438 1.20
128 on 49,084 2.00
128 off 19,650 1.81
64 on 51,349 3.05
64 off 14,854 2.65

Going from 256 to 64 colours roughly doubled the error, 1.20–1.27 up to 2.65–3.05 (measured). Switching dithering on or off at the same colour count moved it by 0.4 at most (measured).

File size follows dithering

At 64 colours the dithered feathered file is 51,349 B and the undithered one is 14,854 B, so 3.5x (measured). At 256 colours the gap is 1.6x (measured). With dithering on, the 128 and 64 colour files are both bigger than the 256 colour one, which looks backwards; a plausible reason is that fewer palette entries need more noise to hide the steps (inference, the encoder internals were not checked).

The undithered 64 colour file also pushed slightly more near-opaque edge pixels to fully opaque, 19,482 against 16,443 (measured). No pixel in either file became fully transparent (measured).

The other two samples barely care

At 64 colours the shadow card was 10,409 B dithered and 9,214 B undithered, with errors of 0.70 and 0.71 (measured). The hard-edge logo was 13,041 B against 11,472 B, errors 2.43 and 2.42 (measured). Both stay within 14% on size. The 3.5x jump only shows up on the feathered sample (measured), so check your own soft-edged assets before generalising.

What the dithered edge looks like

Zoomed to 3x on a checkerboard, the undithered 64 colour feathered circle shows visible steps along the fade, and the dithered one swaps those for fine grain (observed in the zoomed images of these samples). The error numbers are close, so the choice is about which artefact you can live with, and the grain is the one that costs about 36,500 extra bytes (51,349 minus 14,854, calculated).

When edge error is the real problem

If 2–3 levels of alpha error is too much, the lever is not the dither flag. Keeping 8-bit alpha untouched gave an error of 0 on all three samples but cannot be saved as an indexed PNG (measured), and WebP lossless kept alpha identical pixel for pixel on the feathered circle at 45,314 B (measured).

The browser-side comparison used ImgIng https://imging.ai/ on the same feathered sample. Its default for a transparent image like this is WebP quality 84, which came out at 47,400 B with an edge alpha error of 0 (measured, desktop browser only).

What this run did not cover

Other pngquant quality and speed settings (not tested). Other encoders (not tested). Real design files, since every sample here was generated (not tested). How different viewers draw a 51-level alpha ramp (not tested).

Before shipping a soft-edged asset, run the same two outputs, dithered and undithered, through any script that compares alpha channels, and keep the smaller one if the error is within a step of the other.