This is a collection of functions for working with images. Internally, these make use of the sharp image library.

@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.

@image/resize(buffer, options)

Returns a new image, resizing the image represented by buffer. The options should include a height and/or width property.