Blog Archive

Friday, November 18, 2011

Lossless and transparency encoding in WebP

In September 2010 we announced the WebP image format with lossy compression. WebP was proposed as an alternative to JPEG, with 25–34% better compression compared to JPEG images at equivalent SSIM index. We received lots of feedback, and have been busy improving the format. Last month we announced WebP support for animation, ICC profile, XMP metadata and tiling. Today, we introduce a new mode in WebP to compress images losslessly, and support for transparency – also known as alpha channel – in both the lossless and lossy modes.

With these new modes, you can now use WebP to better compress all types of images on the web. Photographic images typically encoded as JPEG can be encoded in WebP lossy mode to achieve smaller file size. Icons and graphics can be encoded better in WebP lossless mode than in PNG. WebP lossy with alpha can be used to create transparent images that have minimal visual degradation, yet are much smaller in file size. Animations compressed as GIFs can use animation support in WebP.

New lossless mode

Our main focus for lossless mode has been in compression density and simplicity in decoding. On average, we get a 45% reduction in size when starting with PNGs found on the web, and a 28% reduction in size compared to PNGs that are re-compressed with pngcrush and pngout. Smaller images on the page mean faster page loads.

New transparency mode

Today, webmasters who need transparency must encode images losslessly in PNG, leading to a significant size bloat. WebP alpha encodes images with low bits-per-pixel and provides an effective way to reduce the size of such images. Lossless compression of the alpha channel adds just 22% bytes over lossy (quality 90) WebP encoding. Smaller alpha overhead means richer images on webpages.

You can find a more detailed compression study for these modes here and sample images in the WebP-Gallery. The bit stream specification has not been finalized, and the encoding and decoding implementations have not yet been optimized for processing speed. We encourage you to try it out on your favorite set of images, check out the code, and provide feedback. We hope WebP will now handle all your needs for web images, and we're working to get WebP supported in more browsers.

Dr. Jyrki Alakuijala is a Software Engineer with a special interest in data compression. He is a father of five daughters, and sings in the Finnish Choir in Zürich. Before joining Google, Jyrki worked in neurosurgical and radiotherapy development.

Vikas Arora is a Software Engineer with a special interest in signal processing and data compression. Before joining Google, Vikas worked in the VLSI domain developing digital and analog signal simulators.

Urvang Joshi is a Software Engineer, especially interested in image processing, machine learning, and computer vision. He is also a table tennis and chess enthusiast.

@Hirou mod_pagespeed, an Apache module will do that for you - http://code.google.com/speed/page-speed/docs/module.html Although the documentation does not state WebP support, mod_pagespeed has it already. However the mod_pagespeed implementation does not support conversion from png and gif as yet, since the bitstream for these features have not yet been finalized.

None of this means anything without 100% browser adoption. It's like writing a book you never publish. Web Technology takes 5-10 years to catch on, so I hope to see some real adoption soon, otherwise this will retain status of "could have been great".

I would like to see Google reach out to other projects and developers to get WebP support in their software and products. No one will use it unless creative software can output it. I would love to see it supported in Blender, as PNG sequences are quite slow. Also I would love to see not just an animation version of it, but specifically a container and codec based on WebP with support for alpha channels, lossless or lossy compression, and mp3 or aac audio (or perhaps FLAC and/or ogg to keep things free). WebP looks encouraging, Motion WebP + audio in a container would be great, particularly if encoding/decoding could be hardware accelerated eventually.

is there a good way to use WeBP while at the same time keep compatibility with older browsers that do not support it?

i.e. is there a simple way to make a page that would cause Chrome to load the WebP image while other browsers would load the jpeg? (without doing things like browsers sniffing and serving different pages to different browsers)

also, another concern is that jpeg images that have been indexed by google image could lost their ranking in the google search database is they were replaced by new files using the WeBP format. any comment on that?

would like to see Google reach out to other projects and developers to get WebP support in their software and products. No one will use it unless creative software can output it. I would love to see it supported in Blende.