image-convert
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Convert
图片格式转换
Converts an image to a different format (PNG, JPG, or WebP).
将图片转换为其他格式(PNG、JPG或WebP)。
Command
命令
bash
agent-media image convert --in <path> --format <format> [options]bash
agent-media image convert --in <path> --format <format> [options]Inputs
输入参数
| Option | Required | Description |
|---|---|---|
| Yes | Input file path or URL |
| Yes | Output format: |
| No | Quality for lossy formats (1-100, default: 80) |
| No | Output path, filename or directory (default: ./) |
| No | Provider to use (default: auto-detect) |
| 选项 | 是否必填 | 描述 |
|---|---|---|
| 是 | 输入文件路径或URL |
| 是 | 输出格式: |
| 否 | 有损格式的质量参数(1-100,默认值:80) |
| 否 | 输出路径、文件名或目录(默认值:./) |
| 否 | 使用的处理提供商(默认值:自动检测) |
Output
输出结果
Returns a JSON object with the converted image path:
json
{
"ok": true,
"media_type": "image",
"action": "convert",
"provider": "local",
"output_path": "converted_123_abc.webp",
"mime": "image/webp",
"bytes": 23456
}返回包含转换后图片路径的JSON对象:
json
{
"ok": true,
"media_type": "image",
"action": "convert",
"provider": "local",
"output_path": "converted_123_abc.webp",
"mime": "image/webp",
"bytes": 23456
}Examples
示例
Convert PNG to WebP:
bash
agent-media image convert --in photo.png --format webpConvert to high-quality JPEG:
bash
agent-media image convert --in photo.png --format jpg --quality 95Convert with custom output directory:
bash
agent-media image convert --in image.png --format webp --out ./converted将PNG转换为WebP:
bash
agent-media image convert --in photo.png --format webp转换为高质量JPEG:
bash
agent-media image convert --in photo.png --format jpg --quality 95使用自定义输出目录进行转换:
bash
agent-media image convert --in image.png --format webp --out ./convertedProviders
处理提供商
- local (default) - Uses sharp library, no API key required
- local(默认)- 使用sharp库,无需API密钥