WebP is an image format employing both lossy and lossless compression that was developed by Google. There are many ways to convert an image to WebP.
A user may use the Sketch tool to convert any image to WebP directly. Just follow these steps:
Export Bitmap
. You may be prompted to specify the image’s quality to be exported on a scale of 0-100.We can convert image formats, like jpeg
and png
, to WebP format using a series of commands. These commands are explained in the following steps:
Open a terminal in the directory where the image you want to convert is present.
Get cwebp, dwebp, and the WebP Libraries. In Linux, we can use the following command:
> wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0-linux-x86-64.tar.gz
This creates a .tar
file at our location.
Extract the .tar
file:
> tar -xzvf libwebp-1.1.0-linux-x86-64.tar.gz
This will create another directory, libwebp-1.1.0-linux-x86-64
.
The directory created above contains many folders, but we are only going to work with the bin folder. Therefore, type the following command in the terminal:
> ./libwebp-1.1.0-linux-x86-64/bin/cwebp/ -q 80 img.png img.webp
// The first parameter is the cwebp directory.
// The second and third parameters refer to the quality.
// The fourth parameter is the name of our source image.
// The fifth parameter is what we want to name our converted image.
RELATED TAGS
CONTRIBUTOR
View all Courses