Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
One tool I’ve been using to optimize images is sharp.
import sharp from 'sharp'
Here’s how I used it to convert images to webp:
await sharp('image.png')
.png({ lossless: true })
.toFile('image.png')
It can do a lot more image processing, like rotate, resize, and more.