---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://framesfield.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Bria RMBG 2.0, BiRefNet v2 & IC-Light V2 fal.ai Skill"
description: "Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex how to automate zero-halo product cutouts and directional relighting under one FAL_KEY: Bria RMBG 2.0 ($0.018 licensed API / $0.03 prompted), MIT BiRefNet v2 (2048px matting with refine_foreground + output_mask), and IC-Light V2 ($0.10/MP with initial_latent light direction + Topaz 24MP finish)."
canonical: "https://framesfield.com/skills/bria-rmbg-birefnet-and-iclight-relight-fal-skill"
---

# Bria RMBG 2.0, BiRefNet v2 & IC-Light V2 fal.ai Skill

> Executable SKILL.md playbook teaching Claude Code, Cursor, and Codex how to automate zero-halo product cutouts and directional relighting under one FAL_KEY: Bria RMBG 2.0 ($0.018 licensed API / $0.03 prompted), MIT BiRefNet v2 (2048px matting with refine_foreground + output_mask), and IC-Light V2 ($0.10/MP with initial_latent light direction + Topaz 24MP finish).

- **Canonical URL:** https://framesfield.com/skills/bria-rmbg-birefnet-and-iclight-relight-fal-skill
- **Raw Payload URL:** https://framesfield.com/raw/skills/bria-rmbg-birefnet-and-iclight-relight-fal-skill
- **Asset Type:** SKILL.md
- **Compatible Hosts:** Claude Code, Cursor, Codex
- **Target Creative Tool:** fal.ai API / Bria RMBG 2.0 / BiRefNet v2 / IC-Light V2
- **License:** MIT
- **Last Verified:** 2026-12-01

## Setup & Install

```bash
mkdir -p .claude/skills/bria-birefnet-iclight-fal && curl -fsSL https://framesfield.com/raw/skills/bria-rmbg-birefnet-and-iclight-relight-fal-skill -o .claude/skills/bria-birefnet-iclight-fal/SKILL.md

```

## Copyable Asset (SKILL.md)

````markdown
---
name: bria-birefnet-iclight-fal
description: Automate fal.ai background removal, 2048px alpha matting, and directional product relighting using Bria RMBG 2.0 (fal-ai/bria/background/remove at $0.018/cutout or $0.03 prompted, 100%-licensed commercial data), BiRefNet v2 (fal-ai/birefnet/v2, MIT open weights with refine_foreground and output_mask), and IC-Light V2 (fal-ai/iclight-v2 at $0.10/MP with initial_latent directional bias). Use when removing product/portrait backgrounds without edge halos or relighting cutouts into photoreal studio scenes.
---

# Bria RMBG 2.0, BiRefNet v2 & IC-Light V2 fal.ai Skill

## 1. Pre-Flight Routing & License Guardrails (Always Print Cost First)
- **Bria RMBG 2.0 (`fal-ai/bria/background/remove`):** `$0.018` per standard cutout (`$0.03` when passing optional `prompt` to isolate a single named item). Trained 100% on licensed data. **Licensing warning:** Never advise commercial users to self-host Hugging Face `briaai/RMBG-2.0` weights (CC BY-NC-4.0)—use paid Bria API or MIT BiRefNet v2 locally.
- **BiRefNet v2 (`fal-ai/birefnet/v2` · MIT):** Use whenever the user needs `output_mask: true` (standalone grayscale matte), `operating_resolution: "2048x2048"` for wispy hair/glass (`model: "Matting"`), or `$0` local MIT self-hosting. Always enable `refine_foreground: true` to strip white backdrop halos.
- **IC-Light V2 (`fal-ai/iclight-v2`):** **`$0.10` per output megapixel**. Always draft at `1MP` (`square_hd` / `1024x1024` = `$0.10`)—NEVER upscale to 4K before calling IC-Light V2! Run Topaz Image API (`$0.08` <=24MP) once on approved relit winners.

## 2. Step 1A — Bria RMBG 2.0 Licensed Cutout ($0.018 | $0.03 w/ prompt)
```bash
curl -sS -X POST "https://fal.run/fal-ai/bria/background/remove" \
  -H "Authorization: Key $FAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_url":"'"$IMAGE_URL"'"}'
```
*(Optional single-object extraction from cluttered scenes: add `"prompt":"amber glass bottle"` -> `$0.03`.)*

## 3. Step 1B — BiRefNet v2 2048px Matting + Decontaminated Alpha Mask
```bash
curl -sS -X POST "https://fal.run/fal-ai/birefnet/v2" \
  -H "Authorization: Key $FAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "'"$IMAGE_URL"'",
    "model": "Matting",
    "operating_resolution": "2048x2048",
    "refine_foreground": true,
    "output_mask": true,
    "output_format": "png"
  }'
```

## 4. Step 2 — IC-Light V2 Directional Relighting ($0.10/MP)
Match `initial_latent` (`Left` | `Right` | `Top` | `Bottom`) to the scene's actual light source and keep `enable_hr_fix: true`:
```bash
curl -sS -X POST "https://fal.run/fal-ai/iclight-v2" \
  -H "Authorization: Key $FAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "'"$CUTOUT_URL"'",
    "prompt": "Product resting on warm honed travertine plinth, morning sunlight from frame left casting soft grounded shadow to the right, crisp studio packshot",
    "initial_latent": "Left",
    "image_size": "square_hd",
    "enable_hr_fix": true,
    "output_format": "png",
    "seed": 4096
  }'
```
Verify zero floating gap under product base and crisp fine-print labels before optionally calling `fal-ai/topaz/upscale/image` (`$0.08` <=24MP).
````

## Example Input

```text
Cut out our matte black ceramic coffee mug using Bria RMBG 2.0 ($0.018), relight it on warm travertine with morning sun from frame left via IC-Light V2 ($0.10), and upscale the approved hero to 24MP via Topaz ($0.08).
```

## Expected Output

```text
Pre-flight estimate: $0.198 ($0.018 Bria RMBG 2.0 + $0.10 IC-Light V2 1MP + $0.08 Topaz 16.8MP PNG).
1) Extracted halo-free RGBA -> 01_mug_cutout.png
2) Relit with initial_latent="Left" + enable_hr_fix=true -> 02_mug_relit_1024.png
3) Upscaled 4x -> 03_mug_hero_4096.png (verified crisp grounded shadow & zero white edge fringe).
```

## Requirements

- `FAL_KEY` environment variable from fal.ai
- Local `curl` and `jq` on PATH

## Known Limits

- Never upscale source images to 4K before IC-Light V2 (multiplies megapixel billing 8x–16x)
- For tiny 6pt regulated cosmetic or beverage labels, inspect relit pixels at 200% and composite the original sharp label crop if needed

## Implementation Notes

## Automated zero-halo cutouts and photoreal product relighting from your CLI

Cutting products cleanly and harmonizing lighting physics used to require three separate tools and manual Photoshop brush masking. This `SKILL.md` gives your coding agent verified endpoints, licensing boundaries, and megapixel-safe defaults across [Bria RMBG 2.0](/specs/bria-rmbg-2), [BiRefNet v2](/specs/birefnet-v2), and [IC-Light V2](/specs/iclight-v2).

## Related guides & workflows

- [Guide 35: AI Background Removal, Alpha Matting & Product Relighting](/guides/ai-background-removal-matting-and-product-relighting-guide)
- [Workflow 47: Product Cutout to IC-Light V2 Relit Hero Compositing](/workflows/product-cutout-to-iclight-v2-relit-hero-compositing-pipeline)
- [Fix 68: Pasted-On Product Cutouts & Flat Shadows](/fixes/ai-product-cutout-pasted-sticker-look-and-shadow-fix)
