Output functions
Basic functions for output and formatting.
scaleImage(bytes, width, height, options)
Scales an image byte array to a target size and returns the scaled image as bytes. Supports several scaling modes and lets you preserve or convert between PNG and JPEG output formats. The optional parameters (mode, quality, format) can be supplied positionally or as a single options object — see the examples below.