Not able to convert images to WebP using imagemin-webp
same problem here
try this:
const imagemin = require('imagemin');
const imageminWebp = require('imagemin-webp');
imagemin(['images/*.{jpg,png}'], {
destination: __dirname + '/images/converted/',
plugins: [
imageminWebp({
quality: 75,
resize: {
width: 1000,
height: 0
}
})
]
}).then(() => {
console.log('Images optimized');
});
you can leave out the resize portion of course;
if one part of the resize parameters is 0 it uses the original ratio (for 2:3 images if you enter 1000 it gets 1000x1500);
i still have no clue how to convert single images...
this is highly cryptic and not well documented despite having over 300k downloads per week on npm;