Skip to content
Lamina PDF
Unreleased

These docs describe changes that aren’t released yet. For the newest release, see the released docs.

Image

An image to draw: a JPEG (passed through), a PNG (alpha as a soft mask) or raw RGBA pixels. The bytes are copied when the image is created. It is decoded once per WASM module, the first time a builder of that module draws it (or width/height is read), so problems with the data (invalid-image, unsupported-image, …) surface there. Written once per document however often it is drawn. It keeps its bytes, so it outlives reset() and decodes again.

get height(): number

Height in pixels (decodes the image if no module has yet).

LaminaPdfError as in.

number


get width(): number

Width in pixels (decodes the image if no module has yet).

LaminaPdfError as in.

number

[dispose](): void

Frees the image at the end of a using block (an alias of free()).

void


free(): void

Frees the image’s WASM memory now; without it, the garbage collector frees it later. A second call does nothing, and any other call afterwards throws disposed. Prefer using.

void


static jpeg(bytes): Image

A JPEG.

Uint8Array

Image


static png(bytes): Image

A PNG.

Uint8Array

Image


static rgba(width, height, pixels): Image

8-bit RGBA pixels, row by row (image-data-length at first use for a wrong length).

number

number

Uint8Array

Image