Editing Image Background
Replace image backgrounds with realistic AI-generated scenes. Automatically segments the foreground subject and generates a new background based on a text prompt.
Quick Start
Requires an each::labs API key. Get one at eachlabs.ai.
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "realistic-background",
"version": "0.0.1",
"input": {
"image": "https://example.com/product-photo.jpg",
"prompt": "RAW photo, 8k uhd, dslr, soft lighting, high quality, modern kitchen countertop with marble surface",
"cfg_scale": 7,
"steps": 20,
"denoising_strength": 0.75
}
}'
Parameters
| Parameter |
Type |
Default |
Description |
| cfg_scale |
integer |
7 |
CFG scale for guidance strength |
| denoising_strength |
number |
0.75 |
Denoising strength |
| image |
string |
- |
Image to replace background |
| max_height |
integer |
1024 |
Maximum output height |
| max_width |
integer |
1024 |
Maximum output width |
| negative_prompt |
string |
(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy... |
Negative prompt |
| only_masked_padding_pixels |
integer |
4 |
Only masked padding pixels |
| prompt |
string |
RAW photo, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3 |
Prompt for background generation |
| sampler_name |
string |
DPM++ SDE Karras |
Sampler. enum: DPM++ 2M, DPM++ SDE, DPM++ 2M SDE, DPM++ 2M SDE Heun, DPM++ 2S a, DPM++ 3M SDE, Euler a, Euler, LMS, Heun, DPM2, DPM2 a, DPM fast, DPM adaptive, Restart |
| seed |
integer |
1 |
Seed |
| steps |
integer |
20 |
Steps |
Examples
Product on a studio surface:
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "realistic-background",
"version": "0.0.1",
"input": {
"image": "https://example.com/watch-photo.jpg",
"prompt": "RAW photo, 8k uhd, luxury product photography, dark slate surface, dramatic studio lighting, soft reflections",
"cfg_scale": 8,
"steps": 25,
"denoising_strength": 0.8,
"sampler_name": "DPM++ SDE Karras"
}
}'
Portrait with outdoor background:
curl -X POST https://api.eachlabs.ai/v1/prediction \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"model": "realistic-background",
"version": "0.0.1",
"input": {
"image": "https://example.com/portrait.jpg",
"prompt": "RAW photo, 8k uhd, beautiful cherry blossom garden in spring, soft natural lighting, bokeh background",
"cfg_scale": 7,
"steps": 20,
"denoising_strength": 0.7,
"seed": 42
}
}'
Related Models
Documentation
1---2name: realistic-background3description: Editing Image Background | AI Background Replacement. Replace image backgrounds with realistic AI-generated scenes. Triggers: background replacement, change background, realistic background, background editing, background swap4---56# Editing Image Background78Replace image backgrounds with realistic AI-generated scenes. Automatically segments the foreground subject and generates a new background based on a text prompt.910## Quick Start1112> Requires an each::labs API key. Get one at [eachlabs.ai](https://eachlabs.ai).1314```bash15curl -X POST https://api.eachlabs.ai/v1/prediction \16 -H "Content-Type: application/json" \17 -H "X-API-Key: $EACHLABS_API_KEY" \18 -d '{19 "model": "realistic-background",20 "version": "0.0.1",21 "input": {22 "image": "https://example.com/product-photo.jpg",23 "prompt": "RAW photo, 8k uhd, dslr, soft lighting, high quality, modern kitchen countertop with marble surface",24 "cfg_scale": 7,25 "steps": 20,26 "denoising_strength": 0.7527 }28 }'29```3031## Parameters3233| Parameter | Type | Default | Description |34|-----------|------|---------|-------------|35| cfg_scale | integer | 7 | CFG scale for guidance strength |36| denoising_strength | number | 0.75 | Denoising strength |37| image | string | - | Image to replace background |38| max_height | integer | 1024 | Maximum output height |39| max_width | integer | 1024 | Maximum output width |40| negative_prompt | string | (deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy... | Negative prompt |41| only_masked_padding_pixels | integer | 4 | Only masked padding pixels |42| prompt | string | RAW photo, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3 | Prompt for background generation |43| sampler_name | string | DPM++ SDE Karras | Sampler. enum: DPM++ 2M, DPM++ SDE, DPM++ 2M SDE, DPM++ 2M SDE Heun, DPM++ 2S a, DPM++ 3M SDE, Euler a, Euler, LMS, Heun, DPM2, DPM2 a, DPM fast, DPM adaptive, Restart |44| seed | integer | 1 | Seed |45| steps | integer | 20 | Steps |4647## Examples4849**Product on a studio surface:**50```bash51curl -X POST https://api.eachlabs.ai/v1/prediction \52 -H "Content-Type: application/json" \53 -H "X-API-Key: $EACHLABS_API_KEY" \54 -d '{55 "model": "realistic-background",56 "version": "0.0.1",57 "input": {58 "image": "https://example.com/watch-photo.jpg",59 "prompt": "RAW photo, 8k uhd, luxury product photography, dark slate surface, dramatic studio lighting, soft reflections",60 "cfg_scale": 8,61 "steps": 25,62 "denoising_strength": 0.8,63 "sampler_name": "DPM++ SDE Karras"64 }65 }'66```6768**Portrait with outdoor background:**69```bash70curl -X POST https://api.eachlabs.ai/v1/prediction \71 -H "Content-Type: application/json" \72 -H "X-API-Key: $EACHLABS_API_KEY" \73 -d '{74 "model": "realistic-background",75 "version": "0.0.1",76 "input": {77 "image": "https://example.com/portrait.jpg",78 "prompt": "RAW photo, 8k uhd, beautiful cherry blossom garden in spring, soft natural lighting, bokeh background",79 "cfg_scale": 7,80 "steps": 20,81 "denoising_strength": 0.7,82 "seed": 4283 }84 }'85```8687## Related Models8889- [rembg](../rembg/) - Background removal90- [flux-fill-pro](../flux-fill-pro/) - Inpainting and fill91- [sdxl-ad-inpaint](../sdxl-ad-inpaint/) - Product ad inpainting9293## Documentation9495- [each::labs Docs](https://docs.eachlabs.ai)96- [API Reference](https://docs.eachlabs.ai/api/overview)