Remove a solid image background
remove_backgroundRemove a solid or near-solid background by flood-filling from the border. color is an optional #rrggbb. The portrait model runs in the browser, not in this handler: MODNet is Apache-2.0, RMBG-1.4 is non-commercial, and the ONNX runtime is too large for the serverless function. Send base64 or a public URL. Private addresses are refused and the decoded file is capped at 10 MB. Returns a PNG 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": "remove_background"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | The image. Provide url or data. | |
| color | No | Background color as #rgb or #rrggbb. Blank samples the corners. | |
| feather | No | ||
| tolerance | No | How far a border pixel may be from the background color, in RGB distance. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | PNG with transparency as base64. | |
| mime | Yes | ||
| note | Yes | ||
| bytes | Yes | ||
| width | Yes | ||
| height | Yes | ||
| method | Yes | ||
| filename | Yes |