color quantization, reduce the number of colors (PNG)

last modified on 7 September 2019, by Cédric Louvrier

pingo could pre-process the image data from PNG using a fast filter. this lossy transformation, which reduce the number of colors, could be more effective using high quality presets (80+) on RGBA samples

N: from 1 to 100 — 1: smaller filesize, worse quality — 100: bigger filesize, better quality
pingo -pngcolor=N target

color quantization

original file: palette-colours.png (71.03 KB): PNG color quantization
original pingo -pngcolor=100 pingo -pngcolor=90
palette colours - original palette colours - pngfilter 100 palette colours - pngfilter 90
71.03 KB — 15359 colors 60.21 KB (0.11s) — 9657 colors 59.09 KB (0.12s) — 9262 colors
dssim - butteraugli 0.00003171 — 0.564144 0.00003431 — 0.546544
pingo -pngcolor=80 pingo -pngcolor=70 pingo -pngcolor=60
palette colours - pngfilter 80 palette colours - pngfilter 70 palette colours - pngfilter 60
53.50 KB (0.10s) — 7295 colors 52.52 KB (0.11s) — 6846 colors 50.43 KB (0.10s) — 6265 colors
0.00008912 — 0.862572 0.00009161 — 0.862658 0.00014487 — 1.179962
pingo -pngcolor=50
palette colours - pngfilter 50
41.66 KB (0.08s) — 5060 colors
0.00145942 — 1.547029

compression level

note that the lossless compression level over this transformation can be increased to get smaller filesize by using -sN

N: from 0 to 9 — 0: fast and good compression — 9: slow, but better compression
pingo -pngcolor -sN target