create MethodStatic

Create a new ImageBuffer.

create(data: Uint8Array, format: ImageBufferFormat, width: number): ImageBuffer

note The ImageBuffer takes ownership of the input Uint8Array.

throws Error if the length of the Uint8Array is not appropriate for the specified width and format.

Parameter Type Description
data Uint8Array The uncompressed image bytes. Must be a multiple of the width times the number of bytes per pixel specified by the format.
format ImageBufferFormat The format of the image.
width number The width of the image in pixels.

Returns - ImageBuffer

A new ImageBuffer.

Defined in

Last Updated: 20 June, 2023