• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

WebP Image Conversion On A Linux Server

convert-images-to-webp

WebP is a new image format that provides a lossless and lossy compression on PNG and JPEG file types. It was developed by Google resulting in up to 80% smaller image size. It is supported on all most all modern browser versions. You can use Nginx and Apache to determine if this format is supported by the browser Agent then server the image in a new format instead of the original image. This file format also supports animated images which can also result in large reductions in image sizes.  Converting to a smaller size file will improve load times and SEO scores and improve the end user experience of viewing your site. This guide is a tutorial to convert images to this format via command line utilities on a Linux server.

Install WebP Tools

Change to the src directory to download the packages:

cd /usr/src

You can retrieve the packages from Googles repository. We are going to get the x86 64 bit linux packages in this example

wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-0.6.0-rc3-linux-x86-64.tar.gz

Untar the files

tar xfvz libwebp-0.6.0-rc3-linux-x86-64.tar.gz

Go in to the directory:

cd libwebp-0.6.0-rc3-linux-x86-64

This will provide the following binaries in the bin directory

cwebp – WebP encoder tool
dwebp – WebP decoder tool
vwebp – WebP file viewer
webpmux – WebP muxing tool
gif2webp – Tool for converting GIF images to WebP

Convert Images to WebP

First you will want to export the bin directory to your path:

PATH=$PATH:”/usr/src/libwebp-0.6.0-rc3-linux-x86-64/bin”

Then export the PATH variable:

export PATH

Now if you type cwebp it should work as a valid command

# cwebp
 Usage:

cwebp [options] -q quality input.png -o output.webp

where quality is between 0 (poor) to 100 (very good).
 Typical value is around 80.

Try -longhelp for an exhaustive list of advanced options.

Now you can convert images to webp formatting using the cwebp command:

cwebp [options] -q quality input.jpg -o output.webp

The quality can be between 0 (poor) and 100 (very good). You will need to determine the quality you are looking for, the lower the quality the more reduction in size you will also achieve.   You will want to replace intput.jpg with the input file and output.webp with the output file.

Once you have converted your images you will also need to detect browser compatibility to server the appropriate image as not all browsers support the WebP format for images at this time.  We will be covering how to do this selection in later guides based on individual web server packages.

Sep 18, 2017LinuxAdmin.io
0 0 vote
Article Rating
CollectD System Performance Monitor Installation On Centos 7Mod_Expires Configuration In Apache
You Might Also Like
 
Setup and Optimize Zend OpCache
 
MariaDB 10 Upgrade From MySQL 5.1 on CentOS 6
Subscribe
Notify of
guest
guest
0 Comments
Inline Feedbacks
View all comments
5 years ago Linux System Administration, Web Hosting Linux Performance Tuning2,937
Recent Posts
  • Laravel Installation Guide For CentOS
  • Openstack Services Explanation And Overview
  • OSSEC Intrusion Detection Installation On Centos 7
  • Configure ProFTPd for SFTP on CentOS
  • How To Check And Repair MyISAM Tables In MySQL
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
62,984 views
Zend Opcache
Setup and Optimize Zend OpCache
46,714 views
Install ffmpeg
FFMpeg Install On CentOS 7
20,909 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz