interface

bun.Image.ConstructorOptions

interface ConstructorOptions

  • autoOrient?: boolean

    Apply EXIF Orientation (JPEG) before any other operation.

  • maxPixels?: number

    Reject inputs whose width × height exceeds this many pixels. The check runs after the header is read but before any pixel buffer is allocated, so a tiny file claiming a huge canvas is refused cheaply. A decoded image takes 4 bytes per pixel, which is 1 GiB at the default. A PNG of 32 KiB can decode to that size. Decoding a PNG that is one very wide row needs up to 20 bytes of memory per pixel, 5 GiB at the default. For untrusted input, set this to the largest image you accept.