Optimize images from a Node.js script

I’ve been utilizing the sharp tool for image optimization.x`

import sharp from 'sharp'

Here’s the method I employed to convert images to the webp format:

await sharp('image.png')
  .webp({ lossless: true })
  .toFile('image.webp')

It can do a lot more image processing stuff like rotate resize etc.