compress
Re-encode an image to a new file at a chosen quality to reduce file size, returning bytes before/after and percent saved.
Instructions
Re-encode an image at a chosen quality to reduce file size, writing the result to a NEW file (source unchanged). Quality is 1-100 (default 80); lower values produce smaller files. The output format defaults to JPEG but can be set via 'format'. Returns the output path plus bytes_before, bytes_after, and saved_percent so you can see how much space was recovered.
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": {
"path": "<path>",
"out": "<out>"
},
"name": "compress"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| out | Yes | Output image path. A new file is created; the source is left untouched. | |
| path | Yes | Source image path. | |
| format | No | Optional output format (defaults to JPEG). Use PNG/WEBP to keep transparency. | |
| quality | No | Quality 1-100 (higher = larger, better). Default 80. |