Back

Testing Google’s Guetzli JPEG encoder

22 March 2017

Simon Foster

This month saw Google launch a new open source JPEG Encoder called Guetzli. Google claim their algorithm creates high quality JPEG images with files sizes 35% smaller than current available methods. Being inquisitive types, we put Google’s new software to the test alongside some of the more established JPEG encoders, to see if it lives up to the hype.

Getting started with Guetzli

Before we get started, we need to install Guetzli. Unlike a lot of JPEG encoders, Guetzli is a command line tool. If the thought of terminal commands is a little intimidating, don’t be put off just yet – it only takes 2 minutes to install.

Firstly, grab Guetzli from Google’s Github page.

You will then need to install Guetzli using a package manager. Simply follow the instructions below;

On Windows

1) Install Visual Studio 2015 and vcpkg
2) Install libpng and gflags using vcpkg:

.\vcpkg install libpng gflags

3) Cause the installed packages to be available system-wide:

.\vcpkg integrate install

If you prefer not to do this, refer to vcpkg’s documentation.
4) Open the Visual Studio project enclosed in the repository and build it.

On macOS

1) Open Terminal.
2) Install Homebrew using the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3) Install Guetzli using the following command:

brew install guetzli

Once the installation process is complete, you are ready to start compressing images.

Simply use the following command to compress your first image:
guetzli [–quality Q] [–verbose] original.png output.jpg

The first time you use Guetzli, you’ll notice it won’t win any competitions for speed. Because of the enormous amount of calculations involved with their compression algorithm, Google recommend keeping 300MB of free RAM before you start compressing an image.

 

JPEG Encoding, a side-by-side comparison

We thought it would be a good idea to test out the results Google’s Guetzli against some of the more established JPEG encoders. So for comparison we’ll be processing images via Guetzli, Adobe Photoshop (using Save for Web – High Quality setting on Photoshop CC 2017), and 2 web based encoders; JPEG.io & TinyJPG.com.

 

Round 1 – The SLR Photograph

Photograph taken on an SLR (Canon 7D)

For our first test, we took an unedited photograph shot on an SLR (Canon 7D) . We reduced the size of the image by 50% to speed up processing, then ran the image through our chosen encoders. The results for our first image vary quite a bit, in terms of file size. Here is a breakdown of how each performed.

[table id=1 /]

We’re not just interested in file size, JPEG’s are images after all. So lets take a look at the quality of the compressed images when we zoom in 500x. Click on the images below to view them at full size.

Round 2 – The Mobile Photograph

Photograph taken on a mobile phone (Google OnePlus 3)

For our second test, we’ll be encoding a photograph taken on a mobile phone (Google OnePlus 3). Again, we ran the image through the encoders and these were the results.

[table id=3 /]

For a visual guide, we zoomed in 500x to inspect that quality of the image. Click on the images below to view them at full size.

Round 3 – The Stock Photograph

Image taken from Unsplash.com

We then tried exactly the same process with an image sourced from the web, from our favourite stock photography site, Unsplash. Unlike the SLR or mobile images we tested in first 2 rounds, we have no idea what processing or compression has already been performed on this photograph.

When we ran this image through our chosen encoders, these were the results.

[table id=2 /]

For a visual guide, we zoomed in 500x to inspect that quality of the image. Click on the images below to view them at full size.

Image quality

I realise our comparison is hardly scientific (and while we don’t claim to be image compression experts) but after a lot of squinting we’ve made some judgements based on the quality of the images. Our observations are as follows:

Photoshop
Photoshops’s images have accurate colour, but lack clarity. The images are more blurred than the originals, contain more artifacts and some of the details are lost. Image quality 3/5.

JPEG.io
We were really impressed with the quality of JPEG.io’s images. The colours have remained true to the original and the quality is good too, with less blur than Photoshop. Image quality 4/5.

TinyJPG.com
The TinyJPG.com images were the poorest quality of the ones we tested, which isn’t a huge surpise given that they were consistently the smallest file size too. The images tended to be slightly darker with a lot of artifacting, though we felt the images were less blured that Photoshop’s. Image quality 2/5.

Google Guetzli
The Guetzli image quality was very impressive. Similar to JPEG.io’s image, the colours are accurate and there is no bluring. Artifacting is kept to an absolute minimum too. Image quality 5/5.

Again, these are just our observations. If you think differently, let us know in the comments section.

 

Conclusion

There is no doubt in our minds that Google’s Guetzli brings something different to the JPEG encoding world. Is it the best option out there? That all depends on what you use it for, but from our quick tests we were certainly impressed, despite none of our tests seeing the 35% additional file size reduction Google claimed (at least compared to the comparisons we made).

All things considered, we came to the following conclusion.

Best for image quality:

Google Guetzli
Guetzli’s images were of greater quality and were more faithful to the source image than any of the others we tested. There is a catch though – Google’s Guetzli does take a while to compress each image, particually larger images. It can be resource intensive on your machine and painfully slow on older machines.

Best for file size:

TinyJPG.com
TinyJPG certainly lives up to its name. It’s images might not be clean compared to Guetzli, but they are significantly smaller. The tiny file sizes makes this the perfect choice if page speed is your primary concern.

Best all rounder:

JPEG.io
A great balance between image quality and file size, we were impressed with the sharp with accurate colours from the JPEG.io images. The files were generally smaller than those produced by Guetzli, and were processed significantly faster too.