I believed I had already squeezed my image file sizes as small as I could get them. But I wanted to see if the latest offering by Google could do any better.
Guetzli specialises in compressing JPGs but it will also do PNGs. It won’t do transparency however, so if you want to compress PNG’s with transparency you are better off with other options.
Guetzli is a different type of image compressor it tries to remove all the data from an image the eye can’t see.
Installing on a mac was pretty easy. It is available as a Homebrew package, and the instructions are on the Guetzli repository.
Once installed, you can run from the command line and modify the quality filter. Playing around with this I could go down to the lowest recommended setting (84) and the images looked identical with a significant drop in file size.
Here are some of the results of my test. I’ve linked to each image below.
- Test 1 original - 44k
Test 1 optimised - 4kb (40k smaller)
- Test 2 original - 93k
Test 2 optimised - 61k (32k smaller)
- Test 3 original - 53k
- Test 3 optimised - 39k (14k smaller)
These are some significant savings, particularly the apple touch icon (40k!!) and based on these results, I would highly recommend giving Guetzli a pass on any project you work on.
It’s not all perfect however there are some caveats that should be mentioned.
Guetzli is serious resource hog. The installation instructions recommend:
You should provide 300MB of memory per 1MPix of the input image.
You should count on using about 1 minute of CPU per 1 MPix of input image.
I needed to shut down any running programmes while optimising my images. This is a bit of a pain for multi-tasking, but you could get around it by scripting the command line and leaving it running overnight if you have some particularly big images to compress or only have access to a low end machine.
There were two instances where Guetzli ballooned my images to several times their original size. Both of these were simple vector PNGs and not resembling a traditional photograph in anyway, so if you have images like this I would probably find another compressor.
On the whole I’ve been really impressed with Guetzli, and I can already see a small bump in rendering times as a result of smaller assets.