New algorithm from Google reduces JPEG file size while also increasing perceived quality

by Jaron Schneider

posted Saturday, March 18, 2017 at 6:00 AM EDT

 
 

Compressing JPEGs to retain as much quality as possible while also reducing their file size is nothing new. In fact, such compression is used by many to keep the size of images on websites down in order to increase performance. But compression to this point has always resulted in either at best mostly retaining visual quality or degrading it in some way, even if it is only a very small amount. Google has changed the game however, with a new open source algorithm that will not only reduce a file's size, but also increase the perceived quality. The algorithm is called Guetzli, and it can reduce a JPEG's file size by as much as 35% while increasing the visual quality or, alternatively, image quality can be significantly improved while keeping file sizes the same. 

Guetzli [guɛtsli] — which means "cookie" in Swiss German — is a JPEG encoder for digital images and web graphics that can enable faster online experiences by producing smaller JPEG files while still maintaining compatibility with existing browsers, image processing applications and the JPEG standard. This is very similar to Google's Zopfli algorithm, which produces smaller PNG and gzip files without needing to introduce a new format. It is different, however, than the techniques used in RNN-based image compression, RAISR, and WebP, which Google explains, "all need client and ecosystem changes for compression gains at internet scale."

 
This 16x16 is a pixel synthetic example of a phone line hanging against a blue sky — traditionally a case where JPEG compression algorithms suffer from artifacts. Uncompressed original is on the left. Guetzli (on the right) shows less ringing artifacts than libjpeg (middle) and has a smaller file size.

Google says that the visual quality of JPEG images is directly correlated to its multi-stage compression process: color space transform, discrete cosine transform, and quantization. The Guetzli algorithm specifically targets the quantization stage in which the more visual quality loss is introduced, the smaller the resulting file. Google says that, "Guetzli strikes a balance between minimal loss and file size by employing a search algorithm that tries to overcome the difference between the psychovisual modeling of JPEG's format, and Guetzli’s psychovisual model, which approximates color perception and visual masking in a more thorough and detailed way than what is achievable by simpler color transforms and the discrete cosine transform." The tradeoff, however, is that while Guetzli creates smaller image files, these search algorithms take much longer to create a compressed image than any other method that is currently available.

 
This is a 20x24 pixel zoomed areas from a picture of a cat’s eye. Uncompressed original on the left. Guetzli (on the right) shows less ringing artifacts than libjpeg (middle) without requiring a larger file size.

That said, in experimentation with the algorithm, the researchers discovered that even when files were kept at the same size, people were rating Guetzli-created images more favorably than the original. The researchers think that since the images look better to the human eye, the time it takes to generate the image is worth the tradeoff. 

The Guetzli team hopes that their algorithm will help webmasters and graphic designers make users' experiences smoother on image-heavy websites, in addition to reducing load times and bandwidth costs for mobile users. They also hope that their success here, and perhaps widespread use of the algorithm, will inspire others to further delve into the image- and video- compression research space. The algorithm is on Github now, and is free to download.

(Seen via Ars Technica)