Documentation Index
Fetch the complete documentation index at: https://docs.bfl.ml/llms.txt
Use this file to discover all available pages before exploring further.
FLUX Erase removes the masked object and reconstructs the scene behind it with contextually coherent content in a single call. Useful for product photography clean-up, removing unwanted elements, scene simplification, or privacy-aware image editing.
Example output
Drag the slider to compare the input image with the masked region outlined in green (left) against the cleaned result (right).More examples
Bar table cleanup
Bar table cleanup
Beach group, fourth person removed
Beach group, fourth person removed
Endpoint
Submit an erase job:Quick start
The API uses an asynchronous workflow:Prepare a mask
Create a black/white PNG at the same resolution as your input image. White (255) marks the pixels to remove, black (0) marks pixels to keep.
Submit an erase request
POST the input image and mask (both base64-encoded) to the endpoint. No prompt is needed — the model uses a built-in erase instruction.
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
image | base64 string | Yes | Input image |
mask | base64 string | Yes | Black/white mask. White (255) = remove, black (0) = keep. Must match the input image dimensions |
dilate_pixels | integer | No | Pixels to dilate the mask before removal. Range 0–100, default 10. Helps the model fully cover object edges |
output_format | string | No | png (default) or jpeg |
Response format
Initial response
Polling response (success)
status is "Ready", use result.sample.
Mask guidelines
- Format: black-and-white PNG at the same resolution as the input image.
- White (255) = pixels to remove. Black (0) = pixels to keep.
- The server converts the binary mask to a green fill internally — callers only send the binary mask.
- Dilation (
dilate_pixels): expanding the mask by a few pixels typically improves removal quality by ensuring the model fully covers object edges. For typical SAM (Segment Anything) masks, start with10.
Tips for best results
- Use a mask that fully covers the object you want to remove. If the mask is leaving an edge, increase
dilate_pixels. - For objects with soft edges (hair, fur, smoke) that masks rarely capture cleanly, use a higher
dilate_pixelsvalue (15–20). - The model was trained on images at ~1 megapixel across 9 aspect ratios from 1:2 to 2:1. Inputs close to these resolutions produce the best results — significant deviations may reduce quality.
Troubleshooting
403 Forbidden— your API key is missing or your project doesn’t have access to this endpoint.422/ validation errors — check base64 encoding and that the mask matches the input image dimensions exactly.- Visible halo around removed object — increase
dilate_pixels. - Reconstruction looks off — verify the mask covers the entire object including shadows or reflections you want gone.

