Background Swap

Replace your photo background with AI

📷

Tap to upload a photo

Selfies and portraits work best

Preview
Before After
Before After
1
Uploading image...
2
Analyzing subject with Vision AI...
3
Generating new background...
How It Works

Pipeline

This demo uses a multi-step AI pipeline to swap backgrounds while preserving the subject:

Step 1: Upload

Image Upload

POST /api/image/upload { "image_base64": "..." }

Step 2: Vision Analysis

LLaVA 1.5 7B

POST /api/gpu { "model": "@cf/llava-hf/llava-1.5-7b-hf", ... }

Describes the subject in detail - appearance, clothing, pose, expression.

Step 3: Image Transform

SDXL Lightning Cloudflare Workers AI

POST /api/gpu/image/transform { "image_base64": "...", "prompt": "[subject] in [background]" }

Transforms the image while keeping the subject and adding the new background.