Table of Contents

How To Use Webp To Compress Png Images On Centos

If you own a website which has lot of images then you might know how important it is to display your website to end user in a fraction of second. A website with lot of images, it is utmost important to make sure your images are compressed enough so that they load faster. Libwebp codec recommended by Google is great utility for png compression.

Libwebp has following coders and decoders...

  1. cwebp to compress png to webp png format
  2. dwebp to convert from webp to png format

Let us first install libwebp. Please go to following link...

cd to following directory and download libwebp

cd /usr/local/share
tar -xvf libwebp-0.4.1-rc1-linux-x86-64.tar.gz

Now let us link the cwebp to our /usr/local/bin directory

ln -s /usr/local/share/libwebp-0.4.1-linux-x86-64/bin/cwebp /usr/local/bin/

OK, we now have all set. We can now compress png image using cwebp.

cwebp -q 80 image.png -o image.webp

Similarly we can convert or decode back from webp format to png.

dwebp image.webp -o image.png

Related Posts