What is WebP?
WebP is a method of lossy and lossless compression that can be used on a large variety of photographic, translucent and graphical images found on the web. The degree of lossy compression is adjustable so a user can choose the trade-off between file size and image quality. WebP typically achieves an average of 30% more compression than JPEG and JPEG 2000, without loss of image quality (see Comparative Study).
The WebP format essentially aims at creating smaller, better looking images that can help make the web faster.
Lossless WebP supports transparency (also known as alpha channel) at a cost of just 22% additional bytes. For cases when lossy RGB compression is acceptable, lossy WebP also supports transparency, typically providing 3× smaller file sizes compared to PNG.
[callout type=”success” size=”lg”]
My own tests: WebP compression is awesome
I am a happy user of ImageMagick, so I created a script to convert JPEG to WebP. The results are staggering:
a 1.2MB 3264×2448 JPEG image taken from an iPhone 5s, with quality factor of 30, gets lossy reduced down to… 80k!
That’s a 15x reduction factor… The result image is quite good, with a slightly imperceptible blur. Using Quality 50 outputs a better image, weighting 106k (factor 11x). I tested smaller images, and the gains are the same! 100k is reduced to 8k at 50 quality, and 6.5k at 30 quality. That’s a factor 12 and 15 respectively.
Since 2014, Google is promoting the use of the new WebP image format, said on their Chromium blog. Google is also, since 2014, in the middle of converting the thumbnails for its YouTube video service to WebP, which it claims cuts down site load times by 10 percent. I couldn’t find the source for this assertion. All I found is blogs referring other blogs. Not to be taken seriously.
[callout type=”warning” size=”lg”]
Available only for Chrome and Opera
Well, I checked one minute ago (Saturday 24th, February 2018), and so can you: hit F12 and inspect a YouTube video thumbnail. It shows JPEG but the header encoding shows WebP. Only for Chrome indeed.
Which web browsers natively support WebP?
Webmasters interested in improving site performance can easily create optimized WebP alternatives for their current images, and serve them on a targeted basis to browsers that support WebP.
- WebP lossy support
- Google Chrome (desktop) 17+
- Google Chrome for Android version 25+
- Opera 11.10+
- Native web browser, Android 4.0+ (ICS)
- WebP lossy, lossless & alpha support
- Google Chrome (desktop) 23+
- Google Chrome for Android version 25+
- Opera 12.10+
- Native web browser, Android 4.2+ (JB-MR1)
- Pale Moon 26+
- WebP Animation support
- Google Chrome (desktop and Android) 32+
- Opera 19+
Wait, Firefox 58 still doesn’t support it…?
It’s not just Firefox. Adding an image format to the web means it’s there for good. We’re not getting rid of PNG, GIF, or JPEG anytime soon, for instance. Adding yet another format is therefore a pretty big commitment.
There’s also the fact that WebP is a kitchen sink format. It does so much that it’s impractical to vet the existing library, or make your own implementation that will match the standard one. That’s quite risky given that it’s something that can easily open up security vulnerabilities and porting concerns.
Add to that the fact that it’s not the only competing image format that touts big benefits. It’s not even close to clear that WebP is the best of the options. Why not JPEG2K or FLIF or BPG instead? And if you say “why not all of them”, then where do we stop? Why not have 100 image formats, and all the megs of code that would require and security vulnerabilities it would open?
There’s also potentially some bad blood involved. When Mozilla and others wanted to add APNG to the web platform, Google pretty much pointlessly opted to go against the grain and root for MNG instead. The result? We had to wait many years for their WebM format and the hack that is GIFV before we got better animated GIFs.
In fact, Google seems to suffer a severe case of “not invented here”. Rather than working with others or improving someone else’s work, they make their own giant “thing” (WebP, PPAPI, SPDY, etc) and just expect the world to follow their lead no matter how intricate and iffy that tech is (or how good the alternatives are). Then their supporters come out of the woodwork to practically bully others into adopting their tech. You can see this all over the place on the bug trackers for browsers, but it’s especially disgusting on the WebP bugs in the Firefox bugtracker: here, here, and there.
Most information available about Google’s WebP is dated from 2014… Why?
To be honest, I found little information on WebP specifications. It doesn’t smell good. Thus, I will cite the thoughts of a Polish hacker named pornel:
WebP is not a good format. It was a clever quick hack betting on the older generation of WebM taking over the world, and that hasn’t happened.
- It doesn’t compress well. It’s twice the size of HEVC. We have similarly-performing VP10 now, but WebP is based on VP8, which is a 2006 codec that has lost to a 2003 codec in the market.
- It’s actually 2 formats under one name. WebP has VP8 and its own lossless thing separately. JPEG-XR, JPEG 2000 and FLIF can use the same algorithm for both lossy and lossless.
- The lossy variant (which is the only interesting one) does not support full-resolution color. You have to live with chroma sub-sampling which messes up anything with sharp saturated colors.
- It’s 8 bit only. This is too little for wide gamut displays which are becoming more common.
- It doesn’t support progressive decoding at all (misses out on awesome HTTP/2 optimization that gives illusion of all images loading instantly).
- The alpha channel can only use lossless encoding. It’s a big problem for non-binary transparency (complex shadows, smoke). That’s the major use case for it on the web, and that’s the least efficient variant of WebP.
- It suffers from generation loss way more than any format.
Developing a new image encoding format for the web is one thing, having it adopted by the industry is a different game. Some good formats are available to replace JPEG: WebP, HEVC (BPG), JPEG-XR (JXR), however their study is at best stalled, because of sterile fights between industry supporters.
[callout type=”default” size=”lg”]
Another failure example: a group of Mozilla developers ran in 2013 a study of various lossy compressed image formats. HEVC (hence BPG) was a clear winner by a wide margin. Their blog still mention it, but as you may have noticed, the link to the study is broken.
Comments? Agree? Disagree? Do you host lotsa pictures and would like to reduce your bandwidth by 1500%? Share your thoughts!