convert_image
Convert images to desired formats like JPG, PNG, WebP, GIF, and more. Adjust dimensions, maintain aspect ratio, and control quality for optimized results.
Instructions
将图片转换为指定格式
Input Schema
Name | Required | Description | Default |
---|---|---|---|
height | No | 目标高度(像素) | |
input_data | No | 图片数据(Buffer或base64字符串,与input_path二选一) | |
input_filename | No | 原始文件名,用于确定格式(使用input_data时建议提供) | |
input_path | No | 源图片文件路径(与input_data二选一) | |
maintain_aspect_ratio | No | 保持宽高比 | |
output_format | Yes | 目标格式(png/jpg/jpeg/gif/bmp/tiff/webp/svg/ico等) | |
output_path | No | 输出文件路径(可选,默认自动生成) | |
quality | No | 压缩质量(1-100,仅适用于有损格式) | |
width | No | 目标宽度(像素) |
Input Schema (JSON Schema)
{
"properties": {
"height": {
"description": "目标高度(像素)",
"minimum": 1,
"type": "number"
},
"input_data": {
"description": "图片数据(Buffer或base64字符串,与input_path二选一)",
"type": "string"
},
"input_filename": {
"description": "原始文件名,用于确定格式(使用input_data时建议提供)",
"type": "string"
},
"input_path": {
"description": "源图片文件路径(与input_data二选一)",
"type": "string"
},
"maintain_aspect_ratio": {
"default": true,
"description": "保持宽高比",
"type": "boolean"
},
"output_format": {
"description": "目标格式(png/jpg/jpeg/gif/bmp/tiff/webp/svg/ico等)",
"type": "string"
},
"output_path": {
"description": "输出文件路径(可选,默认自动生成)",
"type": "string"
},
"quality": {
"description": "压缩质量(1-100,仅适用于有损格式)",
"maximum": 100,
"minimum": 1,
"type": "number"
},
"width": {
"description": "目标宽度(像素)",
"minimum": 1,
"type": "number"
}
},
"required": [
"output_format"
],
"type": "object"
}