Google has announced the release of Guetzli, a new image compression algorithm that creates high quality JPEG images that are up to 35% smaller than other algorithms. Smaller image file sizes allow your webpages to be downloaded faster, improving user experience. The JPEG images that are produced are compatible with existing browsers, image processing tools, and the JPEG standard.
The quality of the images remains high even with the size improvements. Take a look at the following comparison, which shows a 20×24 pixel area of a zoomed in cat’s eye. On the left is the uncompressed image, in the middle is a libjpeg version, and on the right is the Guetzli image.
Many people prefer the Guetzli image over the libjpeg one. In the example above, the Guetzli version has fewer ringing artifacts than the libjpeg one. Guetzli works best on high quality images, and those images which have not already been compressed by some other algorithm.
You can find the source code for Guetzli on GitHub. To use it, you can either build from source or download the binary. The binary can take in a PNG or JPEG file and will output an optimized JPEG image.
guetzli [--quality Q] [--verbose] original.png output.jpg
guetzli [--quality Q] [--verbose] original.jpg output.jpg
The –quality flag allows you to set the quality in libjpeg quality units. To see a trace of the encoding, you can pass the –verbose switch.
There are some tradeoffs to consider. The Guetzli algorithm can take noticeably longer than other currently available methods. Also, Guetzli does use a decent amount of memory. For every 1MPix of image you are compressing, you should have 300MB of memory available.
In my view, these tradeoffs are well worth it in order to achieve smaller files sizes and reduce user load times without sacrificing image quality. Download it and try it out for yourself!