Crop image
crop_imageCrop a local image to a specified pixel region and save the result to an output path. Use zero-based coordinates applied after EXIF auto-orientation.
Instructions
Crop a local image to a pixel region and save the result. Coordinates are zero-based and apply after EXIF auto-orientation. Returns the source and output paths plus metadata.
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": {
"image": "<image>",
"left": "<left>",
"top": "<top>",
"width": "<width>",
"height": "<height>"
},
"name": "crop_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | Yes | Zero-based y offset of the crop region. | |
| left | Yes | Zero-based x offset of the crop region. | |
| image | Yes | Absolute path to a local image on the machine running this MCP server. | |
| width | Yes | Crop width in pixels. | |
| height | Yes | Crop height in pixels. | |
| quality | No | Encoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output. | |
| lossless | No | Use lossless encoding where supported (WebP and AVIF). | |
| file_name | No | Optional base file name; path separators are not allowed. The actual image format determines the extension. When multiple outputs are produced, -1, -2, ... suffixes are appended. Existing files are never overwritten. | |
| background | No | CSS color used as the background, for example #ffffff or transparent. | |
| output_dir | No | Absolute directory where the output file is saved. Defaults to IMG_OUTPUT_DIR, or ~/img-output. The directory is created automatically. | |
| output_format | No | Output image format. PNG, JPEG, WebP, AVIF, TIFF and GIF are supported. | |
| compression_level | No | PNG compression level (0-9); higher is smaller and slower. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | ||
| source | Yes | ||
| details | No | ||
| operation | Yes |