Công cụ hình ảnh
Đổi kích thước ảnh
resize-image
Use Resize Image through the Zavilo SDK. Check input limits, parameters, output and supported modes below.
H · Headless
Quick actions
Input files 1Output files 1
Đầu vào
Accepted input contract for this Tool.
| Kind | file |
|---|---|
| File count | 1 – 1 |
| Accepted MIME types | image/jpeg, image/png, image/webp |
Tham số
Pass these values through request.options.
| Parameter | Type | Bắt buộc | Mặc định | Giá trị / Phạm vi | Mô tả |
|---|---|---|---|---|---|
width |
integer | Optional | — | 1 – 16384 | Target width in pixels. At least width or height is required. |
height |
integer | Optional | — | 1 – 16384 | Target height in pixels. At least width or height is required. |
keepAspectRatio |
boolean | Optional | true |
— | Preserve aspect ratio. When width and height are both provided, fit inside that box. |
format |
enum | Optional | original |
original | jpg | png | webp | Output image format. |
quality |
number | Optional | 0.92 |
0.5 – 1 | Output quality from 0.5 to 1.0. |
Đầu ra
Result contract returned after successful processing.
| Type | files |
|---|---|
| File count | 1 – 1 |
| MIME types | image/jpeg, image/png, image/webp |
| Metadata | width, height, inputBytes, outputBytes |
| ZIP archive | No |
Ví dụ cơ bản
Choose a supported integration mode and copy the generated starter code.
Headless
const result = await client.run("resize-image", {
file,
options: { keepAspectRatio: true, format: "original" }
});
console.log(result.files, result.data, result.metadata);
Embedded
await client.mount({ tool: "resize-image", target: "#zavilo-tool", mode: "embedded" });
This page is generated from the SDK Tool Definition used by the runtime.