Tutorials focusing on Linux, programming, and open-source

Guetzli - JPEG Image Compression

Guetzli is a new image compression tool that was open sourced by Google in 2017.
Here I will show you how to install and use it on Ubuntu Linux which is a lot easier than I expected and takes less than 5 minutes.
Other distros will be very similar with only needing to change how you install the necessary packages.

Steps

Install the necessary packages.

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

Clone the project

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

Build it

cd guetzli
make

Move the final product into your PATH.

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

Clean up by removing the source

cd $HOME
rm -rf guetzli

Usage

The easiest way to use the tool is like so which will use a quality rating of 95.

guetzli --quality 95 input.jpg output.jpg

You can think of the quality parameter as a percentage between 1 and 100. However, if you provide a quality level below 84 you will get the following error message:

Since most of us don't have 4k displays, I decided to use GIMP to shrink the image down to 1620 x 1080 (100% quality) which should fit within a normal 1920 x 1080 display. This shrank the original size from 3.5 MB to a 1.7 MB image which just goes to show that sometimes the best thing you can do is to shrink an image before using compression.

Next I compressed the shrunken image using a quality setting of 84 with guetzli and gimp and compared the results.

This amount of compression is impressive as it means you could store 5.3 times as many images instead of just 3.7 times as many with Gimp.

Of course, all this compression is useless if the output image is noticeably uglier. I'll let you decide for yourself with the image below which has all files opened side-by-side and zoomed in on the right page. I can't tell the difference so I'll be using guetzli from now on.

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites. More info.