Skip to content

PNG Compression Comparison (Icons)

Albert Huang edited this page Mar 23, 2017 · 1 revision

Introduction

I recently had to convert an Inkscape SVG (an application icon) to multiple sizes of PNG. Those PNGs were also compressed losslessly to save space. I did some interesting benchmarks for lossless PNG compression, and here's what I found...

Tools and Commands:

Reference PNGs are directly from Inkscape's PNG output. They were copied to ~/png-bench/ref, and provide the basis of the command below.

  • setup: for b in pingo zopflipng pngout advpng; do mkdir -p ~/png-bench/$b; cp ~/png-bench/ref/*.png ~/png-bench/$b; done
  • pingo (closed): for p in ~/png-bench/pingo/*.png; do wine pingo -s4 "$p"; done
  • zopflipng (open, Apache): for p in ~/png-bench/zopflipng/*.png; do ./zopflipng -y -m "$p" "$p"; done
  • pngout (closed): for p in ~/png-bench/pngout/*.png; do ./pngout-static "$p"; done
  • advpng (open, GPLv2): for p in ~/png-bench/advpng/*.png; do ./advpng -z -4 "$p"; done
albert@debian:~/png-bench$ du -sb ref pingo/ pngout/ zopflipng/ advpng/
153809	ref
126768	pingo/
130626	pngout/
126994	zopflipng/
132301	advpng/

Results

Round 2

Same commands were run again to see if any more compression could be extracted. Interestingly, pingo was able to compress even further by shaving 36 more bytes...

153809	ref
126732	pingo/
130626	pngout/
126994	zopflipng/
132301	advpng/```

# Conclusion
This is NOT meant to be an exhaustive benchmark, but it does provide a rough insight to how PNG icon compression tools perform.