PVL Remove Background V2 (fal.ai)
BiRefNet cutouts on demand, with the hard cases in mind
- image
- foreground
- mask
Background removal is the most commoditized operation in this whole space, and also the one where edges still get people fired up. This node is a hosted version of the current default answer: fal.ai's fal-ai/birefnet/v2 endpoint, i.e. BiRefNet, the model that became the community's go-to for hair, fur, and fine boundaries. You feed it an image, it returns the subject cut out - no model download, no models/background_removal/ folder, no VRAM.
If you already have BiRefNet running locally, this node is redundant and probably slower than your GPU. But if you're on a laptop, a shared box, or a machine where every GB of VRAM is spoken for, a per-image hosted cutout is a perfectly sane trade.
How it works
The image is base64-encoded and POSTed to fal's BiRefNet v2 endpoint with your model choice and resolution. Batches are submitted in parallel and polled together. The result comes back as a foreground image, and if you ask for it, a mask.
The model dropdown matters more than people expect. BiRefNet isn't one model:
- General Use (Light) - the default, fastest, fine for a solid subject on a contrasting background.
- General Use (Light 2K) - same idea, higher resolution input.
- General Use (Heavy) - slower, better on complex edges.
- Matting - the one for semi-transparency: veils, glass, smoke, motion blur. A plain segmentation model cannot represent a half-transparent pixel; this one predicts fractional alpha.
- Portrait - human subjects.
The knowledge base's advice applies here verbatim: for a solid subject, Light is plenty; for hair, test the Heavy/Portrait options; for anything transparent, you need Matting.
The inputs that matter
model- pick per the above. This is the input that decides quality.operating_resolution-1024x1024or2048x2048. Feeding a 4K image to the 1024 option silently throws away the edge detail you wanted; go 2K when the source is big.output_mask- off by default. Turn it on to get the MASK output; this is what you need if you're feeding the cutout into an inpaint or compositing against a different background rather than just keeping transparency.refine_foreground- on by default; keeps the subject's edge clean. Leave it on.output_format-png(default) orwebp.
Outputs: foreground (IMAGE) and mask (MASK, only meaningful with output_mask on).
Installing it
Pack install, same as every node in "ComfyUI Assistant Node":
cd ComfyUI/custom_nodes
git clone https://github.com/pvlprk/comfyui-pvl-api-nodes
Restart ComfyUI, then export FAL_KEY="..." before launching. No model files - BiRefNet lives on fal's servers.
Common issues
The failure modes here are the same ones the whole background-removal genre has always had. The biggest: a perfect mask still looks pasted on without relighting - if the cutout subject doesn't match the new scene, that's a compositing problem, not this node's problem. Second, watch the operating_resolution mismatch described above; it's the most common self-inflicted wound. Third, output_mask is off by default, so if your graph expects a MASK wire and gets an error, that's why. And remember: the request (and your image) leaves your machine. For a one-off e-commerce cutout that's fine; for a 500-image dataset being processed overnight, the API bill will make you re-read the pricing page.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model | COMBO | General Use (Light) | 5 options: General Use (Light), General Use (Light 2K), General Use (Heavy), Matting, Portrait |
| operating_resolution | COMBO | 1024x1024 | 2 options: 1024x1024, 2048x2048 |
| output_format | COMBO | png | 2 options: png, webp |
| output_mask | BOOLEAN | false | — |
| refine_foreground | BOOLEAN | true | — |
| sync_mode | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| foreground | IMAGE | — |
| mask | MASK | — |