Remove background
remove_backgroundRemoves solid or near-solid backgrounds from local images using color-distance keying and outputs transparent PNG or WebP files for compositing and design tasks.
Instructions
Remove a solid or near-solid background from a local image using color-distance keying, with optional auto border sampling, tolerance, feathering and despill. Outputs a transparent PNG or WebP. This is not ML/AI segmentation.
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": "remove_background"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | Absolute path to a local image on the machine running this MCP server. | |
| despill | No | Remove background-color spill from semi-transparent edge pixels. | |
| feather | No | Soft-edge width in the same 0-100 color-distance scale. 0 gives a hard edge. | |
| 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. | |
| tolerance | No | Color-distance tolerance (0-100). Higher removes more shades close to the background. | |
| 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 format; PNG or WebP keep the transparency. | png |
| background_color | No | Background color to remove. If omitted, it is estimated from the image border. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | ||
| source | Yes | ||
| details | No | ||
| operation | Yes |