What is guetzli?

Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality. Guetzli-generated images are typically 20-30% smaller than images of equivalent quality generated by libjpeg. Guetzli generates only sequential (nonprogressive) JPEGs due to faster decompression speeds they offer. – github.com/google/guetzli

Jump to: guetzli usage examples | guetzli on linux | guetzli on windows | guetzli performance | sample photos


Building guetzli on Ubuntu Linux

First, we will install the software required to build guetzli. The machine I’m using is a virtual machine running ubuntu-core 16.04.1 with the latest updates. First, install these packages required to build guetzli from source.

sudo apt-get install git gcc make pkg-config libpng-dev

Next, clone the guetzli repo and compile the source code.

git clone https://github.com/google/guetzli.git
cd guetzli

Copy the compiled binary to /usb/bin/

sudo cp bin/Release/guetzli  /usr/bin/

Execute guetzli to see the usage syntax and command line options


Guetzli JPEG compressor. Usage: 
guetzli [flags] input_filename output_filename

  --verbose   - Print a verbose trace of all attempts to standard output.
  --quality Q - Visual quality to aim for, expressed as a JPEG quality value.

Installing the guetzli binary for Windows

The guetzli project also provides binary versions of guetzli for Windows and Mac OSX. At the time of this writing the latest version of guezzli is 1.0.

Download guetzli_windows_x86-64.exe and place it in your path.

On my Windows 10 system I downloaded guetzli_windows_x86-64.exe, renamed it to guetzli.exe and saved it in c:\dev\bin\ which is already in my PATH.

guetzli usage examples

Compress an image with 85% quality

guetzli --quality 85 image.jpg image-out.jpg

Batch compress png files into jpegs on linux

TODO Add the proper command
find -name *.png --exec {}

Batch encode images on windows

batch encode jpg images mkdir output for %x in (*.jpg) do guetzli %x output\%x

with verbose output and quality specified mkdir output for %x in (*.jpg) do c:\dev\bin\guetzli –verbose –quality 84 %x output\%x

batch encode png images

mkdir output
for %x in (*.png) do c:\dev\bin\guetzli --verbose --quality 84 %x output\%x.jpg
cd output
ren *.png.jpg *.
ren *.png *.jpg

Batch encode images in parallel on linux

Functionally, you can do this with GNU parallel by invoking it like this:

# parallel 'guetzli --quality 84 {} {.}.jpg' ::: *.png**

wget https://github.com/google/guetzli/releases/download/v0/bees.png
for i in 1 2 3 4 5 6 7; do cp bees.png $i.png; done
time parallel 'guetzli --quality 84 {} {.}.jpg' ::: *.png

Photo Processing Time Comparison Chart

For these tests, I used the 64-bit windows binary on my PC which has the following specs.

Intel i7-3520M CPU @ 2.90GHz
Samsung 850 EVO SSD
Windows 10 64-bit

This chart shows the difference in processing time for different size images. The original donuts.jpg is 8MP and was taken with an iPhone 6. I used paint.net to resize the original image, saving each with 97% jpeg quality.

filename resolution file size exectime new size savings
donuts-640x480.jpg 640x480 144,949 46 secs 97,906 32%
donuts-800x600.jpg 800x600 206,475 59 secs 148,175 28%
donuts-1024x768.jpg 1024x768 305,922 96 secs 217,476 29%
donuts-1600x1200.jpg 1600x1200 628,241 210 secs 441,178 30%
donuts-2400x1800.jpg 2400x1800 1,209,597 450 secs 823,475 32%
donuts.jpg 3264x2448 1,952,571 840 secs 1,472,419 25%

Photo Compressed with guetzli

Closeup inspection of Compression Artifacts

Here you can see the compression artifacts introduced by guetzli. Although noticeable, they are much less visual than standard jpeg compression artifacts. Original Image Closeup Compressed Image Artifacts

guetzli Encoded Sample Photos

Black & White Photo

How well does guetzli compress black & white images? The original file(748K) was compressed by 41% with a new size of 442K.

B&W Photo compressed with guetzli

PNG Screenshot

This PNG screenshot was captured using Greenshots for Windows. The guetzli encoded jpeg is bigger than the original PNG and has visual artifacts. I would avoid using guetzli on png screenshots and leave that job to another tool such as pngcrush

PNG Screenshot compressed with guetzli

PNG Video Screen Grabs

Here are some PNG format video stills from the Big Buck Bunny movie. The encoded files are exceptionally smaller at 84% quality but we are also converting from png to jpeg.

Intro Screen Original PNG - Size: 2,879K
Encoded JPEG - Size: 336K
Intro Screen Original PNG - Size: 1,771K
Encoded JPEG - Size: 137K
Video Still
Original PNG - Size: 2,280K
Encoded JPEG - Size: 215K
Video Still
Original PNG - Size: 1,491K
Encoded JPEG - Size: 153K (974% smaller)

Stock Photos

To see how guetzli does on typical images I’ve chosen a few from pexel.com. Each photo was downloaded at original size and encoded with guetzli at 84% quality.

Original 652K
Encoded 254K
61% smaller
Original 2.3MB
Encoded 1.4MB
39% smaller
Original 2,012K
Encoded 980K
51% smaller
Bird on a Wire
Original 3460K
Encoded 383K
89% smaller
Original 9.5MB
Encoded 4.4MB
54% smaller
Couple in Meadow
Original 5MB
Encoded 2.3MB
54% smaller
Original - 4,724K
Encoded - 3,824K
19% smaller
B&W Woman's Face
Original - 462K
Encoded - 154K
67% smaller
Cup of Coffee
Original 4,534K
Encoded 606K
87% smaller

Issues & Caveats

EXIF information is NOT preserved

Version 1.0 of the tool removes EXIF data from the output file. This may be by design to lower file size but there are currently NO command-line options to retain EXIF data. If you compress your images you should retain the originals if you care about keeping the EXIF data.

Missing EXIF orientation values result in upside down images

If the source photo contains EXIF orientation data the compressed image may appear upside down or rotated. This is because the EXIF image is stripped from the final images.

Quality 84% is great

Most images looked great, almost indistinguishable when compressed at 84%. Choosing 84% quality cuts the file size in half from 100% quality, processing time does not change much when you choose a lower quality setting. There will be small percent of your images that will look better choosing a high quality output.

Compressing beyond 84% quality

If you choose a quality lower than 84% the tool will not run and prompts you to edit the source code. There is an issue opened here that suggests adding a –force flag to guetzli to support quality levels lower than 84%.


Keywords: Image Compression, guetzli, google, jpeg encoder, open source