图片缩放
image_resizeResize images to exact dimensions or by scale factor. Supports cover, contain, fill, inside, and outside fit modes, returning the resized image as base64 PNG.
Instructions
缩放图片到指定尺寸。
支持三种模式:
指定width和/或height(保持宽高比,fit模式可选)
指定scale(按比例缩放,如0.5为缩小一半,2.0为放大一倍)
参数:
image: 图片路径或URL
width: 目标宽度(像素)
height: 目标高度(像素)
scale: 缩放比例(0.01-10.0)
fit: 缩放模式(cover/contain/fill/inside/outside),默认inside
output_path: 可选,保存到文件路径
返回:缩放后的图片(base64 PNG)和元信息
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | 缩放模式 | inside |
| image | Yes | 图片路径或URL(http/https开头为URL,否则为本地路径) | |
| scale | No | 缩放比例 | |
| width | No | 目标宽度(像素) | |
| height | No | 目标高度(像素) | |
| output_path | No | 可选:输出图片保存的文件路径。无论是否设置,图片都会以base64返回。 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| width | Yes | ||
| format | Yes | ||
| height | Yes | ||
| size_bytes | Yes |