I have a script to convert images to node, but am having an issue where I receive the successful message, yet nothing is output.
import imagemin from "imagemin";
import webp from "imagemin-webp";
var outputFolder = "./FSS-assets/webp"; // Output folder
var PNGImages = "./FSS-assets/*.png"; // PNG images
var JPEGImages = "./FSS-assets/*.jpg"; // JPEG images
imagemin([PNGImages], outputFolder, {
plugins: [webp({
lossless: true // Losslessly encode images
})]
}).then(function() {
console.log("Images converted!");
});
imagemin([JPEGImages], outputFolder, {
plugins: [webp({
quality: 65 // Quality setting from 0 to 100
})]
}).then(function() {
console.log("Images converted!");
});
I am running
- node v14.16.0
- imagemin v8
- imagemin-webp v6
I have also tried using a relative folder path to no avail. This is on Windows 10.
That's because
imagemin
has 2 paramsinput
andoptions
You are giving 3params.From the Doc:
So for your code it will be: