Skip to content

image

An RGBA Image in row-major order from top to bottom.

get rid(): number

number

Resource.rid

close(): Promise<void>

Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.

Promise<void>

Resource.close

rgba(): Promise<Uint8Array<ArrayBufferLike>>

Returns the RGBA data for this image, in row-major order from top to bottom.

Promise<Uint8Array<ArrayBufferLike>>

size(): Promise<ImageSize>

Returns the size of this image.

Promise<ImageSize>

static fromBytes(bytes): Promise<Image>

Creates a new image using the provided bytes by inferring the file format. If the format is known, prefer [@link Image.fromPngBytes] or [@link Image.fromIcoBytes].

Only ico and png are supported.

ParameterType
bytesnumber[] | ArrayBuffer | Uint8Array<ArrayBufferLike>

Promise<Image>

static fromPath(path): Promise<Image>

Creates a new image using the provided path.

Only ico and png are supported.

ParameterType
pathstring

Promise<Image>

static new(
rgba,
width,
height): Promise<Image>

Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height.

ParameterType
rgbanumber[] | ArrayBuffer | Uint8Array<ArrayBufferLike>
widthnumber
heightnumber

Promise<Image>

PropertyTypeDefined in
heightnumber
widthnumber

function transformImage<T>(image): T

Transforms image from various types into a type acceptable by Rust.

See tauri::image::JsImage for more information. Note the API signature is not stable and might change.

Type Parameter
T
ParameterType
image| null | string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Image

T