Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Compressing PNG Images With WebP

"WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster." - source

Installation

You can install WebP support on Ubuntu 18.04 and 16.04 by running the following command:

sudo apt update && sudo apt install webp -y

Usage

cwebp \
  -q 60 \
  input.png \
  -o output.webp

By doing this, I converted a 325.1 kB PNG file down to just 21.3 kB, which is 93% compression.

WebP isn't supported everywhere. It will work in Chrome and Firefox, but other browsers/devices may have issues.

References

Last updated: 9th June 2019
First published: 24th May 2019

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch