Google Research has released details of its new and more efficient method for encoding JPEG images, promising to cut a third off JPEG image file-sizes with equal (or improved) appearance – but at the cost of greater time needed for compression, relative to the venerable libjpeg method that has been in use for decades.
The announcement by Google software engineers Robert Obryk and Jyrki Alakuijala explains that the new compression algorithm does not affect web compatibility (like the average video format, digital image formats are essentially wrappers for content that could be encoded in any number of ways – the important thing is that the browser/viewer/player knows how to handle the different compression formats it might find after the JPEG marker).
‘[While] Guetzli produces smaller image file sizes without sacrificing quality, we additionally found that in experiments where compressed image file sizes are kept constant that human raters consistently preferred the images Guetzli produced over libjpeg images, even when the libjpeg files were the same size or even slightly larger. We think this makes the slower compression a worthy tradeoff.’
The underlying compression algorithms behind popular implementations of JPEG have always been lossy; once a web version has been generated from a high-quality original master, the lost pixel information cannot be recovered (except, arguably by AI – another field of interest for Google’s image researchers). Therefore any compression technique needs to downsample in a manner which leads to the highest perceptual image quality possible, since there is no ‘way back’.
Slower compression is likely to be an insignificant factor for desktop design environments, but has far bigger usage and resource ramifications for the millions of process threads which run every day over the internet, converting selfies, food shots and other user-generated content into optimised formats for viewing.
The first issue would be latency, as increasingly impatient web-users would need to be soothed by progress indicators and other palliatives while their uploaded content takes a little longer to reach the end of the workflow.
Secondly, Guetzli would seem set to have a significant resource footprint compared to the long-established image compression libraries currently in use (mostly over Apache or other Linux-based frameworks). The algorithm’s machine-learned procedures could have impact at scale in widespread deployment. Presumably Google are considering optimisations and rational solutions to speed up Guetzli’s compression speed performance.
The prize may be worth the effort: JPEG, long since the victor in the image format wars of the late 1990s, now joins PNG in accounting for 73% of all content in websites – petabytes of data on a rolling basis, largely using technologies and standards which have not changed in nearly twenty years.
When the story came to prominence at Hacker News, the original author of libjpeg – the current JPEG encoding standard – Tom Lane, commented:
‘As the author of the original libjpeg (back in 1991), I think this has been a long time coming! More power to Google.’
Libjpeg was among the first open source contributions to the web. Its open access lent the JPEG format a distinct advantage in a period where diverse companies and interests were hoping that the creation of better and more efficient image standards would lead to a big licensing payday. Most famous among these cases was Compuserve/Unisys’s attempt to monetise the LZW compression format for the Graphic Interchange Format (GIF) schema. Ultimately the limited colour palette of GIF combined with a growing perceived hatred of animated GIF images by web-users to pretty much kill the format until a huge resurgence in recent years due to the advent of Tumblr and several other hugely popular social media sites.
LZW had already been in use for UNIX compression and other systems for some time, and remains an efficient lossless encoding algorithm for the high-quality TIFF schema, still used in print publishing workflows and as high-res original masters.