Skip to content
Tauri
Releases

image

Classes

Image

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

Extends

Properties

PropertyType
private readonly #ridnumber

Accessors

rid
get rid(): number

Source: core.ts:222

Inherited from

Resource.rid

Methods

close()
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.

Returns

Promise< void >

Inherited from

Resource.close

Source: core.ts:234


rgba()
rgba(): Promise< Uint8Array >

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

Returns

Promise< Uint8Array >

Source: image.ts:79


size()
size(): Promise< ImageSize >

Returns the size of this image.

Returns

Promise< ImageSize >

Source: image.ts:86


fromBytes()
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 (based on activated feature flag).

Note that you need the image-ico or image-png Cargo features to use this API. To enable it, change your Cargo.toml file:

[dependencies]
tauri = { version = "...", features = ["...", "image-png"] }
Parameters
ParameterType
bytesnumber[] | ArrayBuffer | Uint8Array
Returns

Promise< Image >

Source: image.ts:52


fromPath()
static fromPath(path): Promise< Image >

Creates a new image using the provided path.

Only ico and png are supported (based on activated feature flag).

Note that you need the image-ico or image-png Cargo features to use this API. To enable it, change your Cargo.toml file:

[dependencies]
tauri = { version = "...", features = ["...", "image-png"] }
Parameters
ParameterType
pathstring
Returns

Promise< Image >

Source: image.ts:72


new()
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.

Parameters
ParameterType
rgbanumber[] | ArrayBuffer | Uint8Array
widthnumber
heightnumber
Returns

Promise< Image >

Source: image.ts:27

Interfaces

ImageSize

Properties

PropertyType
heightnumber
widthnumber

Functions

transformImage()

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 parameters

Parameter
T

Parameters

ParameterType
imagenull | string | number[] | ArrayBuffer | Uint8Array | Image

Returns

T

Source: image.ts:97


© 2024 Tauri Contributors. CC-BY / MIT