Origami.

image

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

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.

Example: to convert a file image.jpeg to WebP format:

$ ori "Origami.image.format(image.jpeg, 'webp')"

resize(buffer, options) #

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