Skip to main content

createImage

Creates an Image object from the raw bytes of a file content. Note that Image objects are not nodes. They are handles to images stored by Figma. Frame backgrounds, or fills of shapes (e.g. a rectangle) may contain images. Example: how to work with images.

Signature

createImage(data: Uint8Array): Image

Remarks

The data passed in must be encoded as a PNG, JPEG, or GIF. Images have a maximum size of 4096 pixels (4K) in width and height. Invalid images will throw an error.

Possible error cases

Image is too small

Image is too large

Image type is unsupported