npx skills add ...
npx skills add starchild-ai-agent/official-skills --skill image-bg-remove
Background removal: transparent PNGs, cutouts, product photos, portraits, pets, group photos. Uses dedicated Bria RMBG 2.0 model — no prompt needed, fast (~3s), cheap ($0.01).
npx skills add starchild-ai-agent/official-skills --skill image-bg-remove
Use this skill for all background removal requests on Starchild.
Covers: portrait background removal (ID photos, headshots), product cutouts (e-commerce white-background), group photo background removal, pet/animal cutouts, object isolation, and preparing transparent PNGs for compositing.
Core principle: call the provided script. Do not re-implement proxy/billing plumbing.
Key difference from other image skills: this skill uses a dedicated background removal model (fal-ai/bria/background/remove — Bria RMBG 2.0), not the general-purpose nanopro/gpt models. No prompt is needed — just provide an image.
⚠️ Execution context — read this first. The code blocks below are Python, not shell commands. Starchild's
bashtool runs/bin/bash -c, which cannot parseexec(open(...))— pasting them directly into a bash command will fail withsyntax error near unexpected token 'open'. Also,exec(open(...))insidepython3 -cfails withNameError: __file__because the script uses__file__for path resolution.Use
python3 - <<'EOF'withfrom exports importwhen calling via the bash tool:The heredoc (
<<'EOF') preserves all quotes and newlines — no escaping needed.
The script reads the local file, base64-encodes it, and sends it to fal.ai as a data URI — no manual URL publishing needed.
Never hand the user the raw fal.media URL. fal serves files with restrictive CSP headers. The only reliable delivery path is the already-downloaded local file:
local_path (e.g. output/images/xxx.png) — the script always downloads on success.output/images/ and viewable in the workspace file panel.send_to_telegram(file_path="output/images/...", message_type="image") or send_to_wechat(file_path="output/images/...", message_type="image").| Parameter | Required | Default | Description |
|---|---|---|---|
image_path | yes* | — | Local workspace file path to the source image |
image_url | yes* | — | Public HTTPS URL of the source image |
output_path | no | auto | Custom output file path. If not set, saves to output/images/ with timestamp. |
*At least one of image_path or image_url must be provided. If both are given, image_path takes priority.
No prompt parameter — this is a pure tool skill. The dedicated model handles background removal automatically without any text instruction.
Use image-bg-remove when the user wants to:
| User says | Use this skill |
|---|---|
| "remove the background" / "去背景" / "抠图" | ✅ Yes |
| "make it transparent" / "透明背景" | ✅ Yes |
| "create a cutout" / "cut out the person" | ✅ Yes |
| "product photo with white background" / "白底图" | ✅ Yes |
| "extract the foreground" / "isolate the subject" | ✅ Yes |
| "remove background from headshot" / "证件照去背景" | ✅ Yes |
| "transparent PNG" / "PNG cutout" | ✅ Yes |
| "remove background from pet photo" | ✅ Yes |
| "batch remove backgrounds" (multiple images) | ✅ Yes — call remove_bg() in a loop |
| User says | Use instead |
|---|---|
| "replace background with a beach" / "换背景" | image-edit (action="replace_bg") |
| "blur the background" / "背景虚化" | image-edit (action="edit") |
| "change background color to blue" | image-edit (action="replace_bg") |
| "edit the image" / "enhance the photo" | image-edit |
| "generate an image from text" | image-create |
Key distinction:
replace_bg) → replaces the background with a new scene using a general-purpose modelFor background replacement workflows, the recommended approach is:
action="blend") to composite onto a new backgroundThis two-step approach produces better results than a single replace_bg call because the dedicated RMBG model produces cleaner edges.
| Property | Value |
|---|---|
| Model | fal-ai/bria/background/remove (Bria RMBG 2.0) |
| Speed | ~3 seconds |
| Cost | ~$0.01 per image |
| Output | Transparent PNG (RGBA) |
| Input formats | JPEG, PNG, WEBP, BMP |
| Max input size | 10 MB |
This is the only image skill that uses a dedicated single-purpose model. All other image skills use nanopro or gpt general-purpose models.
On error:
| Format | Extension | Notes |
|---|---|---|
| JPEG | .jpg, .jpeg | Most common input |
| PNG | .png | Supports existing alpha channel |
| WebP | .webp | Modern web format |
| BMP | .bmp | Legacy format |
Maximum file size: 10 MB.
| Issue | Solution |
|---|---|
| "File not found" | Check the file path is relative to workspace root |
| "Unsupported image format" | Convert to JPEG/PNG/WebP first |
| "Image too large" | Resize to under 10 MB before processing |
| "Submit failed: 401" | Check FAL_KEY env var (local) or sc-proxy config (production) |
| Timeout | Rare — the model usually completes in ~3s. Retry once. |