Friday, November 18, 2011

Lossless and transparency encoding in WebP

Urvang
Vikas
Jyrki

By Jyrki Alakuijala, Vikas Arora, and Urvang Joshi, Software Engineers, WebP Team

Cross-posted with the Chromium Blog

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.

Posted by Scott Knaster, Editor

23 comments:

  1. Very nice, I updated the Wikipedia-article.

    ReplyDelete
  2. @SyP: Thanks a ton for updating the wiki page!

    ReplyDelete
  3. Appreciating the new features. Now I only need a chrome extension that does server side conversion of jpgs, pngs and gifs to WebP, a bit like Opera Turbo.

    ReplyDelete
  4. @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.

    ReplyDelete
  5. Vikas and Urvang,
    You guys need to get some pictures where you are at least smiling. It looks like this is a picture of when they let you outside for air and your ticked off that they want you to pose.

    ReplyDelete
  6. Why you don't just buy this company and their patents ?
    http://www.jpegmini.com/main/home

    They use the standard jpeg file format and they reduce the size by a factor up to x5

    ReplyDelete
  7. But AskMP: They ARE!!!! ;-)

    Nice work on the WebP, guys.

    ReplyDelete
  8. 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".

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. If you can get printer manufacturers, camera manufacturers and image editing/viewing applications to add support for webp then it could really take off. Without that I can't see this taking off.

    ReplyDelete
  11. This is a lossless format. As a developer, I can make a second set of all my png images very easily. Nothing gets lost.

    ReplyDelete
  12. Please make a javascript implementation of the decoder (with output) so that this can be used on all modern browsers.

    ReplyDelete
  13. Please make a javascript implementation of the decoder (with CANVAS output) so that this can be used on all modern browsers.

    ReplyDelete
  14. what a coincidence. i received ur update as i was struggling for the past few days to compress couple of pics for upload. its nice u updated me. thanks to google for making things easy n faster.

    ReplyDelete
  15. 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.

    ReplyDelete
  16. 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?

    ReplyDelete
  17. You should consider renaming it GPEG for Google Picture Expert Group, heh. The rhyme and similarity would speed adoption. Something about filename.webp bugs me. :P

    ReplyDelete
  18. 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.

    ReplyDelete
  19. This is excellent, I can't wait for widespread adoption!

    ReplyDelete
  20. get it built into paint.net, gimp, acdsee and photoshop then we may see it take off.

    ReplyDelete
  21. I'd love to see it supported in PDFs. Right now, for lossless image encoding in PDFs, I use ZIP compression... yes... uggg...

    ReplyDelete
  22. "Please make a javascript implementation of the decoder (with output) so that this can be used on all modern browsers."

    It seems that this has already been done: http://webpjs.appspot.com/

    I haven't tried it, but the WebPJS site says it supports Chrome, Opera, Firefox, Safari, and IE 6-9.

    Of course you can also just detect WebP support and serve JPEG/PNG images to older browsers if you don't like the idea of image transcoding via JS.

    ReplyDelete