Suppose there are some pictures in png
format in a folder.
They all need to be converted to webp
format. To do this, you need to enter the command in the terminal:
for file in *.png; do
cwebp $file -o "${file%.*}.webp"
done
After that, the webp
images will appear in the same folder.
If a folder contains images in different formats, for example png
and jpg
, then to convert them all to webp the command will be like this:
for file in *.{png,jpg}; do
cwebp $file -o "${file%.*}.webp"
done