Compress an image
compress_imageRe-encode an image at a quality from 1 to 100, optionally capping the longest edge. Send base64 or a public URL. Private addresses are refused and the decoded file is capped at 10 MB. Returns the image as base64.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file": "<file>"
},
"name": "compress_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | The image. Provide url or data. | |
| choice | No | original | |
| maxEdge | No | Longest edge in pixels. Omit it to keep the size. | |
| quality | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Compressed image as base64. | |
| mime | Yes | ||
| note | Yes | ||
| after | Yes | ||
| bytes | Yes | ||
| label | Yes | ||
| width | Yes | ||
| before | Yes | ||
| format | Yes | ||
| height | Yes | ||
| quality | Yes | ||
| filename | Yes | ||
| extension | Yes | ||
| savedBytes | Yes | ||
| keptOriginal | Yes | True when compressing only made the file larger, so the original was returned. | |
| savedPercent | Yes |