Background removal

From awesome-genmedia/skills · View interactive version

Background removal is an AI agent skill from the GitHub repository awesome-genmedia/skills. 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 photo

How to use this skill

Skill file

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

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.