Jump to content
Donations Read more... ×
Sign in to follow this  

Google works to make JPEG graphics smaller but not sucky

Recommended Posts


The Guetzli project shows there's room to improve the venerable compression tech. Too bad Google's software is slow and not so practical for most sites right now.


It's a common problem: A website's text is smudged with stray pixels. It's as much fun as seeing white dog hairs on the black couch.


The culprit is the JPEG file format, which can compress graphics so they load faster on your PC and eat up less of your phone's monthly data plan. There have been lots of efforts to do better -- Microsoft's JPEG XR and Google's WebP and RAISR among them -- but their success has been limited by the ubiquity of JPEG support.


Now Google thinks it's found a better way to compress JPEG. In research published Thursday, it details technology called Guetzli that cuts JPEG file sizes by 35 percent in its testing. The idea isn't to replace JPEG, but tweak its settings to minimize the likelihood we'll notice problems when files are squeezed.


Smaller file sizes might seem an arcane technology concern, but they're crucial to fast-loading websites. The average web page has ballooned from about 1 megabyte five years ago to about 2.5MB today, according to the HTTP Archive, and bigger pages load slowly. The faster the web page, the happier everyone is: Speed means we buy more online, read more news pages and spend more time checking friends' social network activity.


For Google's Guetzli speed boost, researchers developed a test called Butteraugli designed to model human vision. Compression works by throwing out data that we won't notice is missing, and the point of Butteraugli is to automate testing of different compression settings. Guetzli fiddles with two particular parts of JPEG compression -- discrete cosine transform, which governs how details like object edges are recorded, and quantization, which governs which colors are preserved and which are sacrificed to cut file size.


"Butteraugli takes into account ... properties of vision that most JPEG encoders do not make use of," Google researchers said in a Guetzli research paper (PDF). They validated their results in a separate study detailing tests of Butteraugli with actual people (PDF).


That automation is key. Guetzli works by producing multiple candidates of compressed JPEGs and then comparing them to see which is best. If you want to try it, Google released Guetzli for free as open-source software.


Google isn't the only one trying this approach. Mozilla, maker of the Firefox web browser, began a project in 2014 called Mozjpeg designed to improve on standard compression engines. Google's tests showed that Guetzli outdoes Mozilla's tool by 29 to 45 percent.




Google says its Guetzli compression produces JPEG images with fewer photo-degrading artifacts. These zoomed-in images show the original at left, Guetzli compression in the middle, and an alternative called libjpeg at right.




Note how the Guetzli compression on the right is smoother but lacks some richer colors of the libjpeg compression in the center. The original image is on the left.


There's no free lunch here, though. Guetzli may indeed produce better perceived quality at a given file size, but note for example how some green areas are washed out in the eye comparison image above. And although Google compared Guetzli to mozjpeg and another JPEG encoder called libjpeg, there are other options, too.


Another problem: speed of compressing images. "Guetzli is rather slow to encode," the researchers said, suggesting it's most likely useful on image-heavy websites. "Although Guetzli may be too slow for many practical uses, we hope that it can show direction for future image format design," the researchers said.



Share this post

Link to post
Share on other sites

Try it out: https://github.com/google/guetzli/


Note: Guetzli uses a large amount of memory. You should provide 300MB of memory per 1MPix of the input image.

To try out Guetzli you need to build or download the Guetzli binary. The binary reads a PNG or JPEG image and creates an optimized JPEG image:

guetzli [--quality Q] [--verbose] original.png output.jpg
guetzli [--quality Q] [--verbose] original.jpg output.jpg

Note that Guetzli is designed to work on high quality images (e.g. that haven't been already compressed with other JPEG encoders). While it will work on other images too, results will be poorer. You can try compressing an enclosed sample high quality image.

You can pass a --quality Q parameter to set quality in units equivalent to libjpeg quality. You can also pass a --verbose flag to see a trace of encoding attempts made.

Please note that JPEG images do not support alpha channel (transparency). If the input is a PNG with an alpha channel, it will be overlaid on black background before encoding.

and if you don't like command line you can use FileOptimizer http://nikkhokkho.sourceforge.net/static.php?page=FileOptimizer


Added Guetzli to the JPEG tool chain when allow lossy compression is enabled (Jyrki Alakuijala).


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.