image
以行优先顺序从上到下排列的 RGBA 图像。
get rid(): number数字
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L318
close(): Promise<void>销毁并从内存中清理此资源。您不应再对此对象调用任何方法,并应放弃对它的任何引用。
Promise<void>
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/core.ts#L330
rgba(): Promise<Uint8Array>返回该图像的 RGBA 数据,以行优先顺序从上到下排列。
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L89
size(): Promise<ImageSize>返回该图像的尺寸。
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L96
static fromBytes(bytes): Promise<Image>通过推断文件格式,使用提供的字节创建新图像。如果已知格式,请优先使用 [@link Image.fromPngBytes] 或 [@link Image.fromIcoBytes]。
仅支持 ico 和 png(取决于激活的功能标志)。
请注意,使用此 API 需要 image-ico 或 image-png Cargo 功能。要启用它,请修改您的 Cargo.toml 文件
[dependencies]tauri = { version = "...", features = ["...", "image-png"] }| 参数 | 类型 |
|---|---|
bytes | Uint8Array | number[] | ArrayBuffer |
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L62
static fromPath(path): Promise<Image>使用提供的路径创建新图像。
仅支持 ico 和 png(取决于激活的功能标志)。
请注意,使用此 API 需要 image-ico 或 image-png Cargo 功能。要启用它,请修改您的 Cargo.toml 文件
[dependencies]tauri = { version = "...", features = ["...", "image-png"] }| 参数 | 类型 |
|---|---|
path | string |
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L82
static new( rgba, width,height): Promise<Image>使用 RGBA 数据(按行优先顺序从上到下)以及指定的宽度和高度创建新图像。
| 参数 | 类型 |
|---|---|
rgba | Uint8Array | number[] | ArrayBuffer |
宽度 | 数字 |
高度 | 数字 |
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L37
| 属性 | 类型 | 定义于 |
|---|---|---|
height | 数字 | 源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L13 |
width | 数字 | 源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L11 |
type MenuIcon: | NativeIcon | string | Image | Uint8Array | ArrayBuffer | number[];一种表示可在菜单项中使用的图标的类型。
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L17
function transformImage<T>(image): T将图像从各种类型转换为 Rust 可接受的类型。
有关详细信息,请参阅 tauri::image::JsImage。请注意,API 签名尚不稳定,可能会发生变化。
| 类型参数 |
|---|
T |
| 参数 | 类型 |
|---|---|
image | | null | string | Uint8Array | number[] | ArrayBuffer | Image |
T
源码: https://github.com/tauri-apps/tauri/blob/dev/packages/api/src/image.ts#L107
© 2026 Tauri 贡献者。CC-BY / MIT