Guetzli is a new open source JPEG encoder that creates high-quality JPEGS that weighs between 29 percent and 45 percent less than what is possible now with available methods. It’s been in the wild for the last four months, but finally, Guetzli got officially launched in a blog post on Google’s developer blog.
Artistic representation of GUETZLI
As a web-developer, building excellent experiences for users should be the top priority. And because speed is essential, especially for websites that use a lot of media, Google’s new encoder will help developer speed-up their apps. With Guetzli you can opt to reduce image sizes, thus speeding up your website or, alternatively, can improve the image quality, while keeping the same size.
Saving a JPEG for web in GIMP
JPEG is a lossy compression method used for digital images, which balances the file size and the quality of images. A good encoder will produce a great image while reducing the file size. The JPEG standard was created by the Joint Photographic Experts Group and was initially approved in 1992 as ITU-T Recommendation T.81 and, in 1994, as ISO/IEC 10918-1.
The standard specifies the codec that defines the way an image is compressed into bytes and decompressed back into an image. The standard, which is, by the way, an excellent read, consists of 6 parts:
With Slides, we don’t make you start from an empty slate. All you have to do is to pick the elements you like best and combine them. Each slide has been carefully crafted to satisfy three key criteria: aesthetic, function and usability. That way you know every element works together seamlessly while enhancing the impact of your content.Learn More Try the Demo
- JPEG Requirements and guidelines (ISO/IEC IS 10918-1 | ITU-T T.81)
- JPEG Compliance testing (ISO/IEC IS 10918-2 | ITU-T T.83)
- JPEG Extensions (EXIF and JFIF) (ISO/IEC IS 10918-3 | ITU-T T.84)
- JPEG Registration authorities (JPEG profiles, SPIFF profiles, SPIFF tags, SPIFF color spaces, APPn markers, SPIFF compression types and Registration Authorities) (ISO/IEC IS 10918-4 | ITU-T T.86)
- JPEG File Interchange Format (JFIF) (ISO/IEC IS 10918-5 | ITU-T T.871)
- JPEG Application to printing systems (ISO/IEC IS 10918-6)
The encoding process for a JPEG is the result of a multistage compression process:
- Color space transformation
- Block splitting
- Discrete cosine transform
- Entropy coding
The JPEG algorithm is popular, especially for the web, where every byte counts. However, while JPEG does a great job for images with smooth variations of tone and color, It’s not suitable for line drawings or iconic graphics. In those cases, a lossless graphics format is used, with the most popular being TIFF, GIF or PNG. For image acquisition, other digital negatives file formats such as NEF for Nikon, CR2 for Canon or PEF, are used for the best possible capture of radiometric characteristics.
The Butteraugli Human Vision Model
“75 percent of ratings are in favor of Guetzli. This implies the Butteraugli psychovisual image similarity metric which guides Guetzli is reasonably close to human perception at high-quality levels.” — Users prefer Guetzli JPEG over same-sized libjpeg; J. Alakuijala, R. Obryk, Z. Szabadka, and J. Wassenberg at Google Research
Guetzli uses a new human visual processing system model called Butteraugli which, according to Google, does a better job in approximating color perception and visual masking than other encoders. Virtually, Butteraugli mimics the way the human eyes perceives colors. For example, because the human eye has a lower spatial resolution for blue than for red and green, with limited blue receptors in the high-resolution area of the retina, Guetzil will encode high-frequency changes in blue less precisely.
What is Guetzli?
If you wonder what the name means, then you’ll be delighted to know that it means cookie in Swiss German. Probably the researchers at Google’s Zurich office are really into sweet things.
20×24 pixel zoomed areas from a picture of a cat’s eye. Uncompressed original on the left. Guetzli (on the right) shows less ringing artefacts than libjpeg (middle) without requiring a larger file size.
Guetzli is a Perceptually Guided JPEG Encoder. This means that the encoder shrinks JPEGs in a visually lossless manner. It performs a loop optimization, with feedback based on Google’s Butteraugli model of human vision.
“Guetzli uses an iterative optimization process. To make the problem simpler, the optimizer is not guided by file size. Instead, it is driven by the perceptual quality target alone. It aims to create a JPEG encoding with perceptual distance below a given threshold, as close to the threshold as possible. Each iteration produces a candidate output JPEG and, at the end, the best (not necessarily the last) one of them is selected.” — Guetzli: Perceptually Guided JPEG Encoder; Jyrki Alakuijala, Robert Obryk, Ostap Stoliarchuk, Zoltan Szabadka, Lode Vandevenne, Jan Wassenberg at Google Research
Optimizing the JPEG
To tweak a JPEG image quality and file size, Guetzli focuses on a process that tries to reduce a significant amount of disordered data, which is hard to compress, into ordered data, a process also known as the quantization stage of compression. Just like anything that starts with “quanti,” it’s quite a complicated process. This process reduces gentle color gradients to single blocks of color and eliminates small details entirely. 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.” — Announcing Guetzli: A New Open Source JPEG Encoder;
Guetzli is not Google’s first effort in compression. However, unlike WebP, WebM or RAISR, Google’s JPEG’s generated with the new Guetzli are compatible with existing browsers, devices, photo editing tools, and, of course, with the JPEG standard. Therefore, developers or users won’t have to adopt a new file format just to enjoy in size reduction, which is the case with WebP.
Size vs. Quality vs. Speed
“[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.” — Announcing Guetzli: A New Open Source JPEG Encoder;
For now, Guetzli is slower than other compression algorithms. The project is still in a beginning stage. However, Google is adamant to keep it running, and, in the long term, improve it.
How Does It Look?
For typical humans, without X-men genes or supervision, Guetzli compressed samples do look better than the libjpeg ones. In my samples, the JPEG files are around the 35 percent mark, and the quality is indeed better.
According to Google, Guetzli gets worse SSIM and PSNRHVS-M than libjpeg, yet, when measured with Butteraugli or from direct human feedback, Guetzli outperforms the latter. In fact, the whole purpose of the encoder is to optimize images for humans rather than for algorithms.
16×16 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 artefacts than libjpeg (middle) and has a smaller file size.
Anyway, you should know that if your display has 8-bit gamma correction or you are testing with non-sRGB colors, some compression artifacts may become visible.
Getting Started with Guetzli
Google is releasing Guetzli as an open source project for anyone to check out and, just like everything related to open source, improve. For now, Guetzli it’s still not ready for prime-time. Even Google has its doubts whether the savings at transfer time are worth the slowdown at decoding time.
Yet, Guetzli has the potential to reshape the web. Faster transfer times, means a more rapid web, especially on mobile devices, and less stress on networks. Obviously, Google also gets the lion’s share. A faster web means more ads served. Anyway, have a look at Guetzli on the project’s GitHub page. Instructions for setting up and using the tool are provided for your platform of choice.