image-resize
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Resize
图像尺寸调整
Resizes an image to a target width or height while optionally maintaining aspect ratio.
将图像调整为目标宽度或高度,可选择保持宽高比。
Command
命令
bash
agent-media image resize --in <path> [options]bash
agent-media image resize --in <path> [options]Inputs
输入参数
| Option | Required | Description |
|---|---|---|
| Yes | Input file path or URL |
| No | Target width in pixels |
| No | Target height in pixels |
| No | Output path, filename or directory (default: ./) |
| No | Provider to use (default: auto-detect) |
At least one of or must be specified.
--width--height| 选项 | 是否必填 | 描述 |
|---|---|---|
| 是 | 输入文件路径或URL |
| 否 | 目标宽度(像素) |
| 否 | 目标高度(像素) |
| 否 | 输出路径、文件名或目录(默认值:./) |
| 否 | 使用的处理提供商(默认值:自动检测) |
必须指定或中的至少一个。
--width--heightOutput
输出
Returns a JSON object with the resized image path:
json
{
"ok": true,
"media_type": "image",
"action": "resize",
"provider": "local",
"output_path": "resized_123_abc.png",
"mime": "image/png",
"bytes": 45678
}返回包含调整后图像路径的JSON对象:
json
{
"ok": true,
"media_type": "image",
"action": "resize",
"provider": "local",
"output_path": "resized_123_abc.png",
"mime": "image/png",
"bytes": 45678
}Examples
示例
Resize to 800px width:
bash
agent-media image resize --in photo.jpg --width 800Resize to exact dimensions:
bash
agent-media image resize --in photo.jpg --width 1024 --height 768Resize with custom output:
bash
agent-media image resize --in image.png --width 500 --out ./resized调整为800像素宽度:
bash
agent-media image resize --in photo.jpg --width 800调整为精确尺寸:
bash
agent-media image resize --in photo.jpg --width 1024 --height 768自定义输出路径调整尺寸:
bash
agent-media image resize --in image.png --width 500 --out ./resizedProviders
处理提供商
- local (default) - Uses sharp library, no API key required
- local(默认)- 使用sharp库,无需API密钥