import torch
from diffusers import BriaFiboEditPipeline
from PIL import Image
# Load the Fibo-Edit-RMBG model
pipe = BriaFiboEditPipeline.from_pretrained(
"briaai/Fibo-Edit-RMBG",
torch_dtype=torch.bfloat16,
)
pipe.to("cuda")
# Load your image
image = Image.open("photo.jpg").convert("RGB")
# Generate foreground mask - no mask needed!
mask = pipe(
image=image,
prompt = {'edit_instruction':'Generate a detailed grayscale alpha matte. Map the opaque foreground to white and the background to black. Produce soft, anti-aliased grayscale gradients at the edges of the subject to represent fine details and transparency.'},
num_inference_steps=10,
guidance_scale=1.0
).images[0]
# Convert mask to grayscale and use as alpha channel
alpha = mask.convert("L").resize(image.size)
image.putalpha(alpha)
# Save the result as RGBA image with transparent background
image.save("output.png")
Citation
@article{gutflaish2025generating,
title={Generating an Image From 1,000 Words: Enhancing Text-to-Image With Structured Captions},
author={Gutflaish, Eyal and Kachlon, Eliran and Zisman, Hezi and Hacham, Tal and Sarid, Nimrod and Visheratin, Alexander and Huberman, Saar and Davidi, Gal and Bukchin, Guy and Goldberg, Kfir and others},
journal={arXiv preprint arXiv:2511.06876},
year={2025}
}