Replace background
Try it interactively →POST /api/image-replace-backgroundReplace an image's background colour. Detects or accepts the existing background colour and fills it with the colour you specify (no transparency).
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| image* | file | — | Input image bytes. |
| keyColor | string | "green" | Colour to replace (`green`, `blue`, or CSS hex). |
| bgColor | string | "#ffffff" | Replacement colour (CSS hex or named). |
| tolerance | number (1…90) | 25 | Hue tolerance (degrees). |
| softness | number (0…30) | 10 | Soft-edge band width. |
| format | enum (jpeg | png) | "jpeg" | Output encoding. |
| quality | number (1…100) | 90 | JPEG quality. |
Response
Modes: binary, json. Cache: yes (24h TTL).