skip to content
Keshav Mohta

convert any image format to Webp format

/ 1 min read

What is WebP

webp is most suitable format for web pages ; these are small and render fast

How To convert

  1. Install webp package
Terminal window
sudo apt install webp
sudo apt update
  1. Single file conversion
Terminal window
cwebp <input/file/path/name.png> -o <output_name>

Batch Job : convert all images from a folder

go to the folder where images are located and run below code in terminal

Terminal window
for f in *.png; do cwebp "$f" -o "converted/${f%.png}.webp"; done

Note: this for loop is good for running any operation as a batch job.