The Internet is full of images, and we all want them to load as fast as possible and look as good as possible. For those companies storing and serving these images, the desire is to keep the images as small as possible. Google’s research team created a new JPEG encoder that will keep everyone happy. It serves up images that look great, but their file size is 35 percent smaller.
The new open source algorithm is called Guetzli, which is Swiss German for “cookie.” Guetzli manages to significantly reduce file size without breaking compatibility with the JPEG standard, web browsers, and image processing applications. That’s important, as it means the algorithm can be used everywhere without anything else having to change.
The three images below attempt to demonstrate how well Guetzli works. The uncompressed image is on the left, the libjpeg version is in the middle, and the Guetzli version is on the right. If you can’t tell the difference, Guetzli has done its job.
JPEG is a lossy compression method for images, which allows a tradeoff to occur between file size and the final quality of the images. A good encoder will produce a great looking compressed image while reducing file size as much as possible. For example, a multi-megabyte image stored in BMP or PNG format can look almost exactly the same converted to a JPEG that’s only a few hundred kilobytes in size.
The encoding process for a JPEG can be broken down into six distinct parts: color space transformation, downsampling, block splitting, discrete cosine transform, quantization, and entropy coding. Each can be optimized, and Guetzli focuses specifically on the quantization stage as this is typically where visual quality is lost.
Tests carried out by Google revealed that users preferred the images Guetzli produced compared to other JPEG encoders. If there is a downside, it’s that Guetzli takes longer to produce a compressed image, but the extra time is more than worth it for the saving on file size.
Guetzli is good news for everyone. Smaller file sizes means less data is being transferred around the Internet and websites will load faster. Another upside is that the transition to using Guetzli will happen quietly in the background without any disruption to that next image search you perform looking for cute cats.