SpyreStudios

Web Design and Development Magazine

  • Design
  • Showcase
  • Inspirational
  • Tutorials
  • CSS
  • Resources
  • Tools
  • UX
  • More
    • Mobile
    • Usability
    • HTML5
    • Business
    • Freebies
    • Giveaway
    • About SpyreStudios
    • Advertise On SpyreStudios
    • Get In Touch With Us

The Developer’s Guide to the WebP Image Format

February 11, 2019 by Alex Fox

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.

What is WebP? How Does WebP Work?

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.

What Makes WebP Worth Using?

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:

  • Lossless compression
  • Lossy compression with percentage scale, similar to JPEG
  • Transparency/Alpha Layers
  • Transparency/Alpha Layer Compression
  • Animated images, similar to GIF

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.

Browser Support for WebP

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.

Saving and Opening WebP Images

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.

  • To open and save WebP in Photoshop on macOS or Windows, download and install the appropriate WebP plugin file for Photoshop.
  • macOS users can also download WebP Viewer from the Mac App Store to get a lightweight viewer application for WebP files with bundled Quick Look support.
  • Windows users can add decoding support for WebP to Photo Viewer with Google’s WebP Codec, which is compatible with Windows XP SP3 and onwards.
  • Linux and macOS users can get command line utilities for encoding and decoding WebP file formats with libwebp, available on Homebrew and direct download.

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:

How to Compress Video For Online Streaming

Implement Autoplaying GIFs Without Using GIFs

How to Reduce Image File Size for Your Website: Best Image Compression Tools

Filed Under: Design, Photoshop, Tools Tagged With: image formats, images, web design

Recent Posts

  • 31 Fresh Design Elements for Spring and Easter
  • 10 Templates for Music Concert Flyers
  • How to Build a Web Scraper Using Node.js
  • Best PHP Books, Courses and Tutorials in 2022
  • How to Get Your First Web Design Client

Archives

  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • May 2008
  • April 2008

Categories

  • Accessibility
  • Android
  • Apps
  • Art
  • Article
  • Blogging
  • Books
  • Bootstrap
  • Business
  • CSS
  • Design
  • Development
  • Ecommerce
  • Fireworks
  • Flash
  • Freebies
  • Freelance
  • General
  • Giveaway
  • Graphic Design
  • HTML5
  • Icons
  • Illustrator
  • InDesign
  • Infographics
  • Inspirational
  • Interview
  • Jobs
  • jQuery
  • Learning
  • Logos
  • Matrix
  • Minimalism
  • Mobile
  • Motion Graphics
  • Music
  • News
  • Photoshop
  • PHP
  • Promoted
  • Rails
  • Resources
  • Showcase
  • Tools
  • Tutorial
  • Twitter
  • Typography
  • Uncategorized
  • Usability
  • UX
  • Wallpapers
  • Wireframing
  • WordPress
  • Work

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

SpyreStudios © 2022