const sharp = require('sharp'); const path = require('path'); const fs = require('fs'); const run = async () => { const inputPath = path.join(__dirname, '../public/assets/images/sh.png'); const outputPath = path.join(__dirname, '../public/assets/images/sh.avif'); if (!fs.existsSync(inputPath)) { console.error('Input file not found:', inputPath); process.exit(1); } try { await sharp(inputPath) .toFormat('avif') .toFile(outputPath); console.log(`Successfully converted ${inputPath} to ${outputPath}`); } catch (error) { console.error('Error converting image:', error); process.exit(1); } }; run();