---
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).
