@convert-img-to-webp/convertimagetowebp
Version:
Convert type of image to webp. Optimize image
13 lines (11 loc) • 333 B
JavaScript
import imagemin from "imagemin";
import imageminWebp from "imagemin-webp";
export const converImage = (pathSrc, pathSave) => {
// folder root
imagemin([pathSrc], {
destination: pathSave, // folder to save image
plugins: [imageminWebp({})],
}).then(() => {
console.log("Images Converted Successfully!!!");
});
};