Google Research announced last Thursday a new file compression algorithm that makes JPEGs up to 35% smaller in comparison with current standards. The new encoder is called Guetzli and it is open source, available on Github right now.
The tech giant had already introduced a similar algorithm for PNG files called Zopfli a couple of years ago. The importance of these new methods is they don’t require the adoption of a new file format. Instead, they use existing standards and enhance their efficiency.
This change will mark a significant improvement in web loading times, particularly on sites that are heavy on content that features media. Guetzli’s only downside is that it takes a significantly longer time to encode images.
How does Guetzli work?
The important thing to know about Guetzli is that not only it makes files smaller but also retains detail and quality by tackling the quantization stage of encoding in a different way.
Traditionally, popular encoders look at the color gradients in images and they equalize everything that is slightly similar to a single color tone. Thus, quality is drastically reduced once the image has been compressed.
Using a new psycho-visual model called Butteraugli, Google claims Guetzli can discern which details to keep and which ones to discard based on visual cues preferred by humans.
“GUETZLI STRIKES A BALANCE BETWEEN MINIMAL LOSS AND FILE SIZE BY APPROXIMATING COLOR PERCEPTION AND VISUAL MASKING IN A MORE THOROUGH AND DETAILED WAY,” says Google.
Human raters were presented with different sets of images encoded by popular platforms like libjpeg, x264, lame, and Guetzli. Each time, testers preferred the image processed using Google’s algorithm.
There are more advantages than disadvantages to Guetzli
The tech giant does note that there is a downside to its latest encoder: it takes way more time than usual to encode images when compared to other widely available platforms.
Google claims the reason behind it all is the same that explains why their standard is able to compress files in an almost lossless way: the Butteraugli model. The method it uses to organize color blocks is, indeed, more thorough and it takes more time.
However, if adopted by the industry, Guetzli could represent a significant advancement for websites and browsers that rely largely on JPEG files for media such as photos and featured images on their posts.
The new algorithm has an even greater advantage on competing encoders like WebP, which is that the web at large already supports JPEG as it is and as it comes out from Guetzli. Other models have new outputs that are promising but require paradigm shifts and widespread adoption by users and content creators.
If you are willing to wait to get better images at smaller sizes, you can grab the code for Google’s new algorithm on Github for free.