Bria Eraser
Bria AI’s Eraser model seamlessly enhances and modifies images with advanced generative capabilities, ensuring flawless visuals. Perfect for refining creative assets, removing distractions, and achieving clean, professional results with minimal effort.
API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/bria-eraser"
# Request payload
data = {
"image": "https://segmind-resources.s3.amazonaws.com/input/eb8b89ca-9506-4e67-8356-6214f5f6162e-4d423914-87ba-4e92-8f28-21538c9c6154.jpeg",
"mask": "https://segmind-resources.s3.amazonaws.com/input/1c67466e-1ad5-42c9-afe4-cecb064dfa9e-4b0596ee-3575-4a58-a64e-37e4c9edf4b5.jpeg",
"mask_type": "manual",
"visual_input_content_moderation": True,
"visual_output_content_moderation": True
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Input the main image URL. Choose high-resolution for better results.
Defines areas to modify with a mask URL. Use adaptive for complex changes.
Select mask origin as manual or automatic. Manual offers precise control.
Allowed values:
Ensures input suits appropriateness needs. Enable for compliance projects.
Ensures output meets standards. Activation recommended for sensitive uses.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Resources to get you started
Everything you need to know to get the most out of Bria Eraser
# Effective Usage Guide for Bria AI – Image Editing API v2
Bria AI’s Image Editing API v2 delivers pixel-perfect, generative edits for object removal, fill-based synthesis, background swaps, canvas expansion, enhancement, and upscaling. Follow this guide to configure the right parameters for your use case and get the best possible output.
---
## 1. Getting Started
1. Supply a high-resolution image URL (`image`).
2. Define a mask URL (`mask`) or let `mask_type=automatic` detect regions.
3. Toggle content moderation flags to match compliance needs.
```json
{
"image": "https://your-cdn.com/source.jpg",
"mask": "https://your-cdn.com/mask.png",
"mask_type": "manual",
"visual_input_content_moderation": true,
"visual_output_content_moderation": true
}
2. Key Parameters & Recommendations
Parameter | Use Case | Recommended Setting |
---|---|---|
mask_type | Precise removal | manual |
Quick edits | automatic | |
visual_input_content_moderation | Regulated industries (health/fin.) | true |
Internal or creative testing | false | |
visual_output_content_moderation | Public-facing campaigns | true |
Rapid prototyping | false |
3. Use-Case Scenarios
A. Object Removal (Eraser)
- •Goal: Strip unwanted items (wires, logos, photobombers).
- •Settings:
- •
mask_type
: manual - •
visual_*_content_moderation
: true (for client deliverables)
- •
- •Tip: Zoom into the mask area and refine boundary pixels for pixel-perfect results.
B. Generative Fill
- •Goal: Populate masked regions with new content.
- •Settings:
- •
mask_type
: automatic (for broad areas) - •Provide a text prompt: “add a coastal sunset with palm silhouettes.”
- •
- •Tip: Keep prompts concise and style-consistent with the source image.
C. Background Removal & Replacement
- •Workflow:
- •Run Eraser to isolate subject.
- •Use Generative Fill with a blank or custom background URL.
- •Settings:
- •
mask_type
: automatic - •New background prompt or image input.
- •
D. Canvas Expansion
- •Goal: Extend edges for responsive layouts or social banners.
- •Settings:
- •
mask_type
: automatic - •Prompt: “extend scene with city skyline at dusk.”
- •
- •Tip: Match lighting and perspective keywords (e.g., “soft evening glow”).
E. Enhancement & Upscaling
- •Goal: Boost sharpness, color fidelity, and resolution up to 4×.
- •Settings:
- •Use the “enhancement” or “upscaling” model endpoint.
- •No mask required.
- •Tip: Input PNG at highest resolution; choose 2× for web, 4× for print.
4. Best Practices
- •Always start with the highest-quality source.
- •Review and fine-tune masks in a photo editor before uploading.
- •For edge artifacts, rerun generative fill on a slightly expanded mask.
- •Keep moderation enabled on public or regulated projects.
Harness Bria AI’s specialized models and these parameter tips to streamline your image-editing pipeline—delivering flawless, safe, and compliant visuals every time.
Other Popular Models
Discover other models you might be interested in.
sdxl-img2img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers

sdxl1.0-txt2img
The SDXL model is the official upgrade to the v1.5 model. The model is released as open-source software

sd1.5-epicrealism
This model corresponds to the Stable Diffusion Epic Realism checkpoint for detailed images at the cost of a super detailed prompt

codeformer
CodeFormer is a robust face restoration algorithm for old photos or AI-generated faces.
