A S C R A P B O O K O F S O L U T I O N S F O R T H E P H O T O G R A P H E R
Enhancing the enjoyment of taking pictures with news that matters, features that entertain and images that delight. Published frequently.
17 March 2017
After developing Guetzil, a new JPEG encoder featuring "excellent compression density at high visual quality," Google has released the source code on GitHub. Guetzil, which means "cookie" in Swiss German, creates JPEGs that are compatible with existing browsers and image processing applications.
Google said Guetzil can either reduce file size 20-30 percent over existing tools using the libjpeg library or improve the quality of the image at the same file size. In Users Prefer Guetzli JPEG Over Same-Sized Libjpeg, the Google team reported that 23 human raters of JPEG images preferred the images processed by Guetzil over those processed from libjpeg, the standard package used to produced JPEGs in most applications.
Guetzil requires about 300-MB per megabyte of image data and takes several minutes to convert the typical image file to JPEG, making it more suitable to cloud-based companies like Google itself trying to optimize bandwidth rather than photographers interested in tweaking a portfolio.
The sample image (see above) from a Google Open Source Blog post announcing the release, compares a typical libjpeg JPEG to a Guetzli JPEG. Google explained:
Guetzli specifically targets the quantization stage in which the more visual quality loss is introduced, the smaller the resulting file. 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. However, while Guetzli creates smaller image file sizes, the tradeoff is that these search algorithms take significantly longer to create compressed images than currently available methods.
In a Hacker News post on the topic, one old hacker was impressed. "As the author of the original libjpeg (back in 1991), I think this has been a long time coming! More power to Google," he wrote.
In the same post, jacobolus addressed the color muting issue. "In general if you want to avoid any color changes in blobs a few pixels in size, you’ll want to take it easy on the compression, and take the hit of a larger file size in trade. I suspect that if you give this algorithm twice the file size as a budget, that green color will come back."
The open source code can be compiled into a command line utility with options for quality and feedback. It converts either PNG or JPEG images to optimized JPEGs based on the
--quality Q
flag equivalent to libjpeg quality.To download the code, visit the GitHub project.