Google's WebP Image Format Adds Lossless Compression and Transparency
The latest version of WebP supports lossy and lossless with or without transparency
Google's WebM and more recently WebRTC have been getting all the attention so it's easy to forget about its open image standard, WebP. Which is a shame because it's probably the most advanced and the most interesting.It may not be or sound as complex as the real-time communications WebRTC is trying to enable, but WebP is very important if only because it's the first image standard to have a chance at challenging the established JPG and to a lesser degree PNG.
There haven't been that many updates about the project lately, but Google wants to make sure that everyone remembers WebP exists and that work is still being done.
"Earlier this month, we released version 0.2 of the WebP library that adds support for lossless and transparency modes to compress images. This version provides CPU and memory performance comparable to or better than PNG, yet results in 26% smaller files," Google's Jyrki Alakuijala wrote.
The numbers are impressive to say the least. Using JPG results in relatively small files, but it means you're giving up on transparency. If you want transparency or are more interested in quality, PNG is the way to go.
But PNG files, which are lossless, are larger. WebP aims to bridge the gap between the two, create files that are smaller than if they were encoded with PNG, but with no quality compromise.
This is why the new lossless mode is important. What's more, WebP is fairly unique in allowing both lossless and lossy compression.
That's not the only thing WebP does that neither PNG nor JPG do, with WebP lossy images can have transparency, meaning you can have files as small as with JPG compression, or smaller and not give up on transparency.
"WebP’s improved compression comes from advanced techniques such as dedicated entropy codes for different color channels, exploiting 2D locality of backward reference distances and a color cache of recently used colors," Google described some of the compression methods it's been implementing to drive down file sizes.
"This complements basic techniques such as dictionary coding, Huffman coding and color indexing transform. We think that we've only scratched the surface in improving compression," it said.
All of these improvements are available in the latest WebP specs and tools. But an image standard is nothing without software to support it. Thankfully, Google has the advantage of owning a browser, the most popular browser in the world by some measurements. The latest WebP specs are supported in the beta channel, i.e. Google Chrome 22.