image
Classes
Image
An RGBA Image in row-major order from top to bottom.
Extends
Accessors
rid
Get Signature
get rid(): numberReturns
number
Inherited from
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L297
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
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L309
rgba()
rgba(): Promise<Uint8Array>Returns the RGBA data for this image, in row-major order from top to bottom.
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L79
size()
size(): Promise<ImageSize>Returns the size of this image.
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L86
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
| Parameter | Type | 
|---|---|
bytes | Uint8Array | number[] | ArrayBuffer | 
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L52
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
| Parameter | Type | 
|---|---|
path | string | 
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L72
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
| Parameter | Type | 
|---|---|
rgba | Uint8Array | number[] | ArrayBuffer | 
width | number | 
height | number | 
Returns
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L27
Interfaces
ImageSize
Properties
| Property | Type | Defined in | 
|---|---|---|
 height | number | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L12 | 
 width | number | Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L10 | 
Functions
transformImage()
function transformImage<T>(image): TTransforms 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
| Type Parameter | 
|---|
T | 
Parameters
| Parameter | Type | 
|---|---|
image | | null | string | Uint8Array | number[] | ArrayBuffer | Image | 
Returns
T
Source: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L97
© 2024 Tauri Contributors. CC-BY / MIT