The WebP image format is a new image encoding format that’s especially appealing to web developers.
It can encode a high density of information within a given file size, allowing higher quality images at lower file sizes. Considering that images make up about 60-percent of the web, lower image file sizes mean faster loading pages, which is something everyone wants. Let’s talk about what makes WebP special, why it’s worth using, and how you can start using it today.
WebP’s compression algorithm is based on the intra-frame encoding algorithm used in the VP8 video compression algorithm. As with VP8, it is a block-based transformation scheme with eight bits of color depth and a YUV 1:2 chroma subsampling ratio (YCbCr 4:2:0), which is the same as the default chroma subsampling ratio on MPEG2 and MP4.
For lossy encoding, WebP uses predictive encoding. Essentially, the encoder can try and predict the value of the next block. When the prediction is good, redundant data can then be removed, improving compression. Only a small remainder, called residual, remains to be transmitted in a compressed format.
You can dig into the technical compression methodology on Google’s WebP Compression Techniques page.
Most importantly, WebP is able to achieve space savings over JPG, the current image standard. Below, you can see a comparison between WebP and JPG on the same image. There is little apparent loss in visual quality. WebP routinely achieves compression improvements of thirty to fifty percent, making it dramatically more efficient than the now twenty-six year old JPEG standard.
There’s more to WebP than just file size savings, however. The standard also includes far more features that JPEG. Whereas JPEG can compression images by a given percentage, that’s the only affordance made to controlling the compression. WebP, on the other hand, offers the following options:
As a result, WebP can end up being a replacement for JPEG, PNG, and GIF file types. However, as we’ve mentioned previously, WebM is the format of choice for modern video and animation playback on the web.
Under lossless WebP, an alpha layer can be added for a file size increase of about 22-percent. Under lossy WebP, lossy alpha layers can be added, achieving file sizes as small as 33-percent of an equivalent PNG file with transparency. As of now, Only WebP supports an 8-bit alpha layer alongside lossy RGB images.
At the time of publican, WebP is natively supported by as much as 71-percent on global web users, as tracked by CanIUse.com. WebP support was added in Firefox 65 and Edge 18, both of which are the most recent version of each browser at the moment. Support for WebP has existed on Chrome and Opera since 2014. In terms of mobile browsers, Android’s default browser and Google Chrome support WebP.
See a detailed breakdown of browser support here.
The biggest current setback is the format’s support by Apple. As of publication, WebP is not yet natively supported by iOS Safari or macOS Safari. This requires a separate image type to be served for unsupported browsers, bringing us in to the realm of polyfills.
You’ll need to expand your normal image workflow to add on support for WebP. As of now, Photoshop doesn’t natively support WebP, but that can easily be added.
Firefox and Google Chrome both open WebP files natively, but Preview is currently unable to handle the images, despite being registered as a program capable of opening the file type.
These files can be loaded into your DOM just like any other image file. In browsers that don’t support WebP natively, Webp Polyfill can load a fallback image file to support less capable browsers.
You might also like the following posts about web standards and image compression:
The post The Developer’s Guide to the WebP Image Format appeared first on SpyreStudios.
Especially when you are at the beginning of your career as a web designer, you may be tempted to accept… Read More
Hosting an event, a birthday or even planning for your own wedding or retirement party? No matter what it is,… Read More
Doing business online and ignoring SEO is parallel to opening a shop in far-flung areas where nobody bothers to visit.… Read More