Background Removal
Remove and replace image backgrounds using each::sense — the intelligent AI agent that automatically selects the best model for your request.
Quick Start
Requires an each::labs API key. Get one at eachlabs.ai.
Using curl
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Remove the background from this image and replace it with a clean white background"},
{"type": "image_url", "image_url": {"url": "https://example.com/product-photo.jpg"}}
]
}
],
"stream": false
}'
Using Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_EACHLABS_API_KEY",
base_url="https://eachsense-agent.core.eachlabs.run/v1"
)
response = client.chat.completions.create(
model="eachsense/beta",
messages=[{
"role": "user",
"content": "Remove the background from this image and replace it with a clean white background"
}],
# Images are included in the message content array above
)
print(response.choices[0].message.content)
Images are sent inside messages using the OpenAI multimodal content format. Maximum 4 images per request.
Streaming
Set "stream": true for real-time Server-Sent Events (SSE) responses, or "stream": false to receive the complete result in a single response. Streaming is useful for showing progress in UIs; non-streaming is simpler for scripts and automation.
Use Cases
| Use Case |
Instruction |
Result |
| E-commerce |
"Remove background, replace with pure white" |
Clean product listing |
| Portrait |
"Replace background with soft gradient bokeh" |
Professional headshot |
| Composite |
"Place this product on a marble kitchen counter" |
Lifestyle product shot |
| Social Media |
"Remove background and add a vibrant gradient" |
Attention-grabbing post |
| Transparent |
"Remove the background completely" |
Subject-only cutout |
Examples
E-commerce Product Cutout
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Remove the background from this product photo and replace it with a pure white (#FFFFFF) background. Keep the product shadow as a soft drop shadow for a floating effect."},
{"type": "image_url", "image_url": {"url": "https://example.com/watch-on-table.jpg"}}
]
}
],
"stream": false
}'
Portrait Background Swap
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Replace the background behind this person with a blurred modern office environment. Match the lighting direction of the original photo. Keep hair edges clean and natural."},
{"type": "image_url", "image_url": {"url": "https://example.com/casual-portrait.jpg"}}
]
}
],
"stream": false
}'
Creative Composite
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [
{
"role": "user",
"content": [
{"type": "text", "text": "Place this person on a dramatic mountain cliff overlooking a misty valley at sunrise. Match the lighting and scale naturally, as if the photo was taken on location."},
{"type": "image_url", "image_url": {"url": "https://example.com/standing-person.jpg"}}
]
}
],
"stream": false
}'
Batch Product Backgrounds
PRODUCTS=(
"https://example.com/product-1.jpg"
"https://example.com/product-2.jpg"
"https://example.com/product-3.jpg"
)
for URL in "${PRODUCTS[@]}"; do
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d "{
\"messages\": [{\"role\": \"user\", \"content\": \"Remove the background and replace with a clean white background. Preserve realistic shadow.\"}],
\"image_urls\": [\"$URL\"],
\"stream\": false
}"
echo "---"
done
Tips for Clean Results
- Mention hair and edges: "Keep hair edges clean and natural" prevents harsh cutout lines
- Specify shadow handling: "Keep a soft contact shadow" or "Remove all shadows"
- Match lighting: When compositing, say "Match the lighting direction of the original"
- Simple subjects first: Single subjects with clear edges produce the best results
- Consistent style: For batch processing, use the exact same prompt for all images
Background Replacement Ideas
| Category |
Background Options |
| Solid Colors |
Pure white, light gray, brand color |
| Gradients |
Soft gray gradient, warm sunset gradient |
| Studio |
Seamless paper backdrop, fabric drape |
| Environmental |
Office, coffee shop, outdoor park |
| Abstract |
Geometric shapes, bokeh circles, texture |
| Seasonal |
Autumn leaves, snow scene, spring flowers |
Related Skills
Related Models
Documentation
1---2name: background-removal-23description: Remove and replace image backgrounds using each::sense AI. Isolate subjects from photos, create transparent backgrounds, swap backgrounds for product photography, portraits, and marketing materials. Supports clean cutouts, background replacement, and environmental compositing. Use for: product photos, portrait backgrounds, e-commerce listings, social media, photo compositing, transparent PNGs. Triggers: remove background, background removal, background eraser, transparent background, cutout, background swap, replace background, isolate subject, bg remove, background changer, product background4---56# Background Removal78Remove and replace image backgrounds using [each::sense](https://docs.eachlabs.ai/sense/overview) — the intelligent AI agent that automatically selects the best model for your request.910## Quick Start1112> Requires an each::labs API key. Get one at [eachlabs.ai](https://eachlabs.ai).1314### Using curl1516```bash17curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \18 -H "Content-Type: application/json" \19 -H "X-API-Key: $EACHLABS_API_KEY" \20 -d '{21 "messages": [22 {23 "role": "user",24 "content": [25 {"type": "text", "text": "Remove the background from this image and replace it with a clean white background"},26 {"type": "image_url", "image_url": {"url": "https://example.com/product-photo.jpg"}}27 ]28 }29 ],30 "stream": false31 }'32```3334### Using Python (OpenAI SDK)3536```python37from openai import OpenAI3839client = OpenAI(40 api_key="YOUR_EACHLABS_API_KEY",41 base_url="https://eachsense-agent.core.eachlabs.run/v1"42)4344response = client.chat.completions.create(45 model="eachsense/beta",46 messages=[{47 "role": "user",48 "content": "Remove the background from this image and replace it with a clean white background"49 }],50 # Images are included in the message content array above51)5253print(response.choices[0].message.content)54```5556> Images are sent inside messages using the OpenAI multimodal content format. Maximum 4 images per request.5758### Streaming5960Set `"stream": true` for real-time Server-Sent Events (SSE) responses, or `"stream": false` to receive the complete result in a single response. Streaming is useful for showing progress in UIs; non-streaming is simpler for scripts and automation.6162## Use Cases6364| Use Case | Instruction | Result |65|----------|-------------|--------|66| **E-commerce** | "Remove background, replace with pure white" | Clean product listing |67| **Portrait** | "Replace background with soft gradient bokeh" | Professional headshot |68| **Composite** | "Place this product on a marble kitchen counter" | Lifestyle product shot |69| **Social Media** | "Remove background and add a vibrant gradient" | Attention-grabbing post |70| **Transparent** | "Remove the background completely" | Subject-only cutout |7172## Examples7374### E-commerce Product Cutout7576```bash77curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \78 -H "Content-Type: application/json" \79 -H "X-API-Key: $EACHLABS_API_KEY" \80 -d '{81 "messages": [82 {83 "role": "user",84 "content": [85 {"type": "text", "text": "Remove the background from this product photo and replace it with a pure white (#FFFFFF) background. Keep the product shadow as a soft drop shadow for a floating effect."},86 {"type": "image_url", "image_url": {"url": "https://example.com/watch-on-table.jpg"}}87 ]88 }89 ],90 "stream": false91 }'92```9394### Portrait Background Swap9596```bash97curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \98 -H "Content-Type: application/json" \99 -H "X-API-Key: $EACHLABS_API_KEY" \100 -d '{101 "messages": [102 {103 "role": "user",104 "content": [105 {"type": "text", "text": "Replace the background behind this person with a blurred modern office environment. Match the lighting direction of the original photo. Keep hair edges clean and natural."},106 {"type": "image_url", "image_url": {"url": "https://example.com/casual-portrait.jpg"}}107 ]108 }109 ],110 "stream": false111 }'112```113114### Creative Composite115116```bash117curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \118 -H "Content-Type: application/json" \119 -H "X-API-Key: $EACHLABS_API_KEY" \120 -d '{121 "messages": [122 {123 "role": "user",124 "content": [125 {"type": "text", "text": "Place this person on a dramatic mountain cliff overlooking a misty valley at sunrise. Match the lighting and scale naturally, as if the photo was taken on location."},126 {"type": "image_url", "image_url": {"url": "https://example.com/standing-person.jpg"}}127 ]128 }129 ],130 "stream": false131 }'132```133134### Batch Product Backgrounds135136```bash137PRODUCTS=(138 "https://example.com/product-1.jpg"139 "https://example.com/product-2.jpg"140 "https://example.com/product-3.jpg"141)142143for URL in "${PRODUCTS[@]}"; do144 curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \145 -H "Content-Type: application/json" \146 -H "X-API-Key: $EACHLABS_API_KEY" \147 -d "{148 \"messages\": [{\"role\": \"user\", \"content\": \"Remove the background and replace with a clean white background. Preserve realistic shadow.\"}],149 \"image_urls\": [\"$URL\"],150 \"stream\": false151 }"152 echo "---"153done154```155156## Tips for Clean Results157158- **Mention hair and edges**: "Keep hair edges clean and natural" prevents harsh cutout lines159- **Specify shadow handling**: "Keep a soft contact shadow" or "Remove all shadows"160- **Match lighting**: When compositing, say "Match the lighting direction of the original"161- **Simple subjects first**: Single subjects with clear edges produce the best results162- **Consistent style**: For batch processing, use the exact same prompt for all images163164## Background Replacement Ideas165166| Category | Background Options |167|----------|-------------------|168| **Solid Colors** | Pure white, light gray, brand color |169| **Gradients** | Soft gray gradient, warm sunset gradient |170| **Studio** | Seamless paper backdrop, fabric drape |171| **Environmental** | Office, coffee shop, outdoor park |172| **Abstract** | Geometric shapes, bokeh circles, texture |173| **Seasonal** | Autumn leaves, snow scene, spring flowers |174175## Related Skills176177- [AI Image Editor](../ai-image-editor/SKILL.md) — General image editing178- [Inpainting & Outpainting](../inpainting-outpainting/SKILL.md) — Fill or extend image areas179- [AI Photo Enhancer](../ai-photo-enhancer/SKILL.md) — Improve photo quality180- [AI Headshot Generator](../ai-headshot-generator/SKILL.md) — Professional headshots181182## Related Models183184- [flux-kontext-pro](../../../models/flux-kontext-pro/SKILL.md) — Best for image editing tasks185- [flux-2-max](../../../models/flux-2-max/SKILL.md) — Highest quality image generation186187## Documentation188189- [each::sense Overview](https://docs.eachlabs.ai/sense/overview)190- [each::labs API](https://docs.eachlabs.ai)