Resize image
resize_imageResize local images to a target width or height using cover, contain, fill, inside, or outside fitting modes, then save the output in your chosen format and quality.
Instructions
Resize a local image with sharp's cover/contain/fill/inside/outside fitting modes and save the result. At least one of width or height is required.
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>"
},
"name": "resize_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | How the image fits the target box. Defaults to cover. Use contain to letterbox, inside to preserve aspect ratio without cropping, or fill to stretch. | |
| image | Yes | Absolute path to a local image on the machine running this MCP server. | |
| width | No | Target width in pixels. At least one of width/height is required. | |
| height | No | Target height in pixels. At least one of width/height is required. | |
| kernel | No | Resampling kernel. Defaults to lanczos3. | |
| quality | No | Encoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output. | |
| lossless | No | Use lossless encoding where supported (WebP and AVIF). | |
| position | No | Crop position/gravity when fit is cover or contain. | |
| 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. | |
| without_enlargement | No | Do not enlarge images that are already smaller than the target. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | ||
| source | Yes | ||
| details | No | ||
| operation | Yes |