Search code examples
imagebashpngwebp

Batch process .png to .webp


I have around 100 .png images, and all of them have to be converted to .webp (Google's image format). I am using Google's CLI tool. Any idea how to batch process them.


Solution

  • You can do it with a help of a simple bash script.

    Navigate to the directory where your images reside and execute this:

    $ for file in *
    > do
    > cwebp -q 80 "$file" -o "${file%.png}.webp"
    > done
    

    You can change the output file name, as you want. But should end with a .webp extension.