26 lines
606 B
JavaScript
26 lines
606 B
JavaScript
const sharp = require('sharp');
|
|
const fs = require('fs');
|
|
|
|
const basePath = 'src/assets/testimonial/';
|
|
const files = [
|
|
'David Morales.avif',
|
|
'Emily Carter.avif',
|
|
'Michael Tan.avif',
|
|
'Rajesh Kumar.avif'
|
|
];
|
|
|
|
async function convert() {
|
|
for (const file of files) {
|
|
const input = basePath + file;
|
|
const output = basePath + file.replace('.avif', '.webp');
|
|
try {
|
|
await sharp(input).webp().toFile(output);
|
|
console.log('Converted', file);
|
|
} catch (e) {
|
|
console.error('Error converting', file, e);
|
|
}
|
|
}
|
|
}
|
|
|
|
convert();
|