Nodes/ComfyUI-FLUX-BFL-API/Flux Erase (BFL)
ComfyUI Node

Flux Erase (BFL)

Object removal that actually leaves the rest alone

By gelasdev·Created 2 years ago·Updated 26 days ago· 49
Flux Erase (BFL)
  • config
  • IMAGE
image
mask
dilate_pixels10
safety_tolerance2
output_formatpng
seed-1
webhook_url
webhook_secret

If you've got a photo with one thing you want gone - the stranger in the background, a parked car, a watermark - this is the node. Flux Erase (BFL) takes your image plus a mask, and BFL's flux-tools/erase-v1 model repaints just the masked region. The whole point, and the thing that separates it from a full-image edit model, is that everything outside the mask comes back untouched. No drift on the rest of the shot.

This is a cloud call, not a local model. It's part of the ComfyUI-FLUX-BFL-API pack, which wraps the Black Forest Labs paid API, so there's no VRAM hit and no model download - but there is an API key, a wait, and a credit burn on every run.

How it works

You feed it two base64 strings, not ComfyUI image tensors. That's the first thing that trips people up. Wire a LoadImage into the pack's Image to Base64 (BFL) node and feed its string output into the image socket. Do the same for your mask - and use the png format there, because JPEG compression mangles the clean black/white edges a mask needs.

The node POSTs to flux-tools/erase-v1, gets back a task ID, and polls get_result?id=... every 5 seconds for up to 40 attempts. Anything that isn't Ready - pending, generating, content moderated, plain error - either retries or returns a black 512×512 image so your workflow never hard-crashes. That black image is the failure tell, not a feature.

The inputs that matter

  • mask - black/white, white (255) = remove, black = keep. Must match the input image dimensions.
  • dilate_pixels - 0–25, default 10. Expands the mask before removal so the model fully covers the object's edges. If you see a ghost halo around the removed object, nudge this up.
  • safety_tolerance - 0–5, default 2. Moderation strictness, 0 being most strict. If a request gets bounced as "Request Moderated," this is the dial.
  • output_format - png (default) or jpeg. Defaults to png here for a reason: erase is a pixel-perfect editing job, don't hand it a lossy round-trip.
  • Optional seed, webhook_url/secret, and config (a Flux Config (BFL) node if you want to override the key or base URL for just this node).

Output is a single IMAGE tensor you can wire straight into SaveImage.

Installing it

This is one pack, so it's one install for all the BFL nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/gelasdev/ComfyUI-FLUX-BFL-API.git

Then restart ComfyUI, grab a key from api.bfl.ai, and drop it into config.ini:

[API]
X_KEY = YOUR_API_KEY
BASE_URL = https://api.bfl.ai/v1/

Or skip the file entirely and use ComfyUI Manager - search "ComfyUI-FLUX-BFL-API". The pack's only declared dependency is torch, which ComfyUI already ships, so there's nothing heavy to install.

Where people get burned

  • Black output out of nowhere. That's the graceful-failure path: moderation hit, task errored, or polling gave up after ~200 seconds. Check the ComfyUI console for [BFL] logs - every request prints a curl equivalent, so you can replay the exact call against the API by hand to see what BFL actually said.
  • Mask as JPEG. Lossy compression turns clean mask edges into grey mush and the model half-removes things. Encode the mask as png.
  • It's not instant. This is a remote model; expect it to take longer than a local inpaint, especially for big images. That's the trade for zero VRAM.

The one honest caveat: for simple "remove the object" jobs, a local instruction-edit model like Klein or Qwen-Image-Edit is often faster and free. Erase earns its keep when you specifically need the rest of the frame bit-identical - the thing only mask-based editing can promise.

CategoryBFL

Inputs (9)

NameTypeDefaultDescription
imageSTRINGInput image (base64-encoded string).
maskSTRINGBlack/white mask (base64-encoded string). White (255) = remove, black (0) = keep. Must match the input image dimensions.
dilate_pixelsINT100–25Pixels to dilate the mask before removal. Range 0-25, default 10. Helps the model fully cover object edges.
safety_toleranceINT20–5Tolerance level for input and output moderation. Between 0 and 5, 0 being most strict, 5 being least strict.
output_formatCOMBOpngpng (default) or jpeg.
seedoptINT-1Optional seed for reproducibility. -1 = random.
webhook_urloptSTRINGURL to receive webhook notifications.
webhook_secretoptSTRINGOptional secret for webhook signature verification.
configoptBFL_CONFIGOptional Flux Config (BFL) override for x-key, base URL, and region.

Outputs (1)

NameTypeDescription
IMAGEIMAGE