Zopfli Compression of PNGs

I've written before about minification of stylesheets and Javascript and briefly mentioned using PNGGauntlet. Compressing images is an easy way to save bandwidth, especially if your hosting provider changes for bandwidth. Jeff Atwood wrote about using Zopfli to compress images and I decided to try it myself.

On average, I'm seeing a 2% to 9% reduction in file size on top of what PNGGauntlet already did! So now all the images on my sites are compressed with Zopfli and I'm saving a few kilobytes on every page load! The only downside is the upfront time required to do the compression. But since that is done once at design-time, it is worth the time.

The Zopfli Github repository includes the source for the compression algorithm as well as a command line tool to compress PNGs (called zopflipng). It's easy to fork and build the tool - it's all done with make as described in the README.

So the next question is what else can I compress? Because of the slower compression speed, Zopfli isn't suitable for on-demand compression but better for one-time use. I found a Nuget package called libzopfli-sharp (source) that will let me do this. Now to find what is worth compressing even further.



Tags

  • Internet
  • www.dougjenkinson.net

Revisions

  • 1/3/2016 - Article written.