Remove flat background (chroma key)
remove_backgroundRemove a solid-color background from a PNG or JPEG and save a transparent PNG locally. Use for flat, uniform backdrops (e.g., green screen) to create clean cutouts without network or quota.
Instructions
Locally remove a flat, solid-color background from a PNG/JPEG and save a transparent PNG — no network, no quota. Use for images with a uniform backdrop (e.g. generated "on a flat pure #00ff00 background"), or to clean up a cutout. The key color is sampled from the image border unless key_color is given. Prefer background="transparent" on generate_image/edit_image when creating new assets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| despill | No | Remove key-color fringe/spill on edge pixels (default true). | |
| key_color | No | Background color to remove as hex, e.g. #00ff00. Default: auto-detected from the image border. | |
| overwrite | No | Replace an existing file at output_path (default false). | |
| tolerance | No | Hard-key per-channel tolerance 0-255 (default 12; used when soft_matte=false). | |
| input_path | Yes | PNG or JPEG to process (absolute or relative to the workspace root). | |
| soft_matte | No | Smooth alpha ramp for anti-aliased edges (default true). false = hard key using tolerance. | |
| output_path | No | Destination .png (default: <input>-transparent.png next to the input). Never overwrites unless overwrite=true. | |
| edge_feather | No | Blur radius for softened alpha edges, 0-64 (default 0). | |
| edge_contract | No | Shrink the matte by this many pixels before feathering, 0-16 (default 0). | |
| include_preview | No | Attach a downscaled preview so you can check the result visually (default true). Set false to save tokens. | |
| opaque_threshold | No | Soft matte: color distance at or above which pixels stay fully opaque (default 96). | |
| transparent_threshold | No | Soft matte: color distance at or below which pixels become fully transparent (default 12). |