How to convert PNG/JPG/TIFF files into more efficient format Webp
The page explains the way to convert PNG(Portable Network Graphics), JPEG or TIFF files into Webp.
WebP is the image format advocated by Google. The format tends to be smallen the file sizes of images, this may help building more perfomant sites.
Conversion methods#
Use Google official tools#
Donwload the compressed file from The directory of Webp conversion tools . Files are prepared for each mainstream OS. The names of files are like these (as of v1.2.4):
Windows: libwebp-1.2.4-windows-x64.zip
Linux: libwebp-1.2.4-linux-x86-64.tar.gz
Mac: libwebp-1.2.4-mac-arm64.tar.gz
Decompress the downloaded file.
After decompression, you'll see some programs inside the directory named bin . There are many programs but only two programs are explained here since others are somewhat useless for typical developers. It may very useful for the develpers who are fighting for image format, I think.
Here's the two programs contained in bin directory. For Windows, .exe suffix is added.
File name | Description |
---|---|
cwebp | Convert PNG/JPEG/TIFF into WebP |
dwebp | Convert WebP into PNG. |
cwebp takes command line options as below:
cwebp <input_file> -q <quiality> -o <output_file>
For example, if you are to convert test.png into test.webp with quiality set to 80 you will write:
cwebp test.png -q 80 -o test.webp
This method is very useful when you want to convert many files at once because of command line interface.
Use softwares supporting WebP format#
Some image viewers and image editors supports saving images as WebP format.
For example, IrfanView has extension plugin to save images as WebP[1] . It is very handy for usual situations. All you need to do is open an image file, then save it as WebP.