Despill helps reduce unwanted color contamination around the edges of a cutout. This is especially useful when the original background leaves a colored fringe on hair, fur, transparent objects, or other soft edges.
Important: Despill is available only in the API. It is not currently exposed as a Studio toggle in the web interface.
What despill does
The BackgroundErase API includes a despill option that performs Lab-space edge cleanup while preserving luminance. In practice, that means it can reduce visible color bleed around the subject without overly flattening brightness or destroying fine edge detail.
Although despill helps clean up edge contamination, the current implementation is optimized for green spill rather than being fully color-agnostic. In practice, it works best on green-tinted fringing and is not intended as a universal cleanup step for all background colors.
API behavior
- Parameter: despill
- Allowed values: boolean
- Default: false
- Applies only when the working image is RGBA
- Has no effect on already-flattened outputs such as JPG
- May be skipped on very large images (roughly > 50 MP)
Good to know: Despill is most useful when you export a format that preserves transparency or edge information, such as PNG or WebP.
When to use despill
- Hair or fur has a colored outline from the original background.
- Soft edges look tinted after background removal.
- You are compositing the subject onto a new background and edge fringing is noticeable.
- You want cleaner cutouts for production or marketing assets.
Example API request
To enable despill, pass despill=true in your API request:
curl -H 'x-api-key: YOUR_API_KEY' \
-F https://api.backgrounderase.com/v2 \
-F 'image_file=@/absolute/path/to/image.png' \
-F 'despill=true' \
-o output.pngTry it in the API Playground
You can also test despill without writing code by using backgrounderase.com/playground. The Playground lets you reproduce API behavior directly in the browser and compare results with and without despill enabled.
Best practices
- Use despill when edge color bleed is visible.
- Prefer PNG or WebP outputs if you want the effect to matter visually.
- Use high-quality source images for the best cleanup results.
- Compare outputs with and without despill when tuning a production pipeline.
