image:

format(buffer, format, [options])

Returns the image represented by buffer in a new image format. The format must be one of the following strings:

  • avif
  • gif
  • heif
  • jp2
  • jpeg
  • jxl
  • png
  • raw
  • tiff
  • tile
  • webp

The options dictionary is passed to sharp’s toFormat() function.