- Remove Object
Description
Remove an object you describe in plain language, with no mask to draw. Name the object in prompt (for example "yellow hammer"), and the route finds it, segments it, and erases it, filling the area behind it so it looks like the object was never there.
How It Works
- A vision-language model reads
promptagainst the image, and SAM 3 segments the matching object. - The object's mask is sent to the Eraser, which removes it and fills the area.
Use /erase instead when you already have a mask, or need to remove something a short description can't single out.
/erase_by_text runs this same route under its older name, reading the object from object_name instead of prompt.
Erase Modes
The composite parameter picks one of two modes, the same as on /erase. Pixel perfect (true, the default) rebuilds only the object's area and blends it into the original, so everything else stays as it was. Context aware (false) also removes what the object casts outside its outline, such as its shadow or its reflection.
When Nothing Matches
If nothing in the image matches prompt, the request still succeeds and returns the input image unchanged.
Output Characteristics
- The modified image is returned at the original resolution.
- With
compositeset totrue, everything outside the object's area stays as it was. - Transparency is not kept: an input with an alpha channel comes back fully opaque.
Content Moderation
This endpoint includes granular content moderation controls to ensure safe usage across all stages of processing:
- Prompt Moderation - Checks
promptand stops processing if it contains inappropriate or restricted content. On by default. - Input Image Moderation - Scans the uploaded image and stops processing if inappropriate or restricted content is detected.
- Output Image Moderation - Evaluates the generated image and blocks the response if it violates safety guidelines.
Constraints
The Bria API supports JPEG, PNG and WEBP files in RGB, RGBA, or CMYK color modes. When the file is of a different type or color mode, the status code 415 will be returned.
The source image to be handled by the API.
Supported input types:
- Base64-encoded string
- URL pointing to an image file that is publicly accessible and available at the time of processing.
Accepted formats: JPEG, JPG, PNG, WEBP.
The object to remove, in natural language, for example "yellow hammer" or "the person on the left". Add color, position or size when the image holds several similar objects.
Selects the erase mode.
true(default), pixel perfect: Only the object's area is rebuilt and blended into the original. Everything else stays as it was.false, context aware: The model also removes what the object casts outside its outline, such as its shadow or its reflection.
Specifies the response mode.
- When
false(default), the request is processed asynchronously: the API immediately returns a status URL to track progress. - When
true, the request is processed synchronously: the API holds the connection open until the process is complete and then returns the final image URL in the response.
Optional URL for receiving the result via webhook when the async job completes. See webhooks.
When enabled, applies content moderation to prompt.
Expected behavior:
- Processing stops if the prompt fails moderation.
- Returns a 422 error with details about which parameter failed.
When enabled, applies content moderation to input visual.
Expected behavior:
- Processing stops if the image fails moderation.
- Returns a 422 error with details about which parameter failed.
- Remove an Object, Pixel Perfect
- Remove an Object and What It Casts, Context Aware
- Deliver the Result to a Webhook
- Quick sync test
from bria_client import BriaSyncClient
client = BriaSyncClient() # reads BRIA_API_TOKEN
response = client.run(
endpoint="image/edit/remove_object",
payload={
"image": "https://bria-datasets.s3.amazonaws.com/object-extraction/tools_construction_flatlay.jpg",
"prompt": "yellow hammer",
},
)
print(response.result.image_url){ "result": { "image_url": "string" }, "request_id": "string" }