If you are familiar with nodejs you can use imagemin-webp
https://www.npmjs.com/package/imagemin-webp
npm i imagemin
npm i imagemin-webp
and then use this script:
const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');
imagemin(['images/*.{jpg,png}'], { //input here
destination: __dirname + '/images/converted/', //output here
plugins: [
imageminWebp({
quality: 75, //quality
resize: { //optional resizing
width: 1000,
height: 0 //if one of the parameters is 0 it scales automatically
}
})
]
}).then(() => {
console.log('Images optimized');
});