Editing

Erase Object by Text

Changed on

Try out this capability in Bria's sandbox Description

Remove specific objects or unwanted elements from an image using natural language descriptions.

This route runs the same pipeline as Remove Object: the object named in object_name is found and segmented, then erased by the Eraser. It takes the same composite modes. The only difference is the field name: this route reads object_name, and /remove_object reads prompt.

If nothing in the image matches object_name, the request still succeeds and returns the input image unchanged.

Content Moderation

  • Prompt Moderation - Checks object_name and 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.

Example: object_name: "table"

<table> <tr> <th style="text-align: center;">Input Image</th> <th style="text-align: center;">Output Image</th> </tr> <tr> <td align="center" style="vertical-align: middle;"> <img src="https://bria-datasets.s3.us-east-1.amazonaws.com/Liza/an_empty_table_in_living_room.png" width="300" style="border-radius: 8px;"> </td> <td align="center" style="vertical-align: middle;"> <img src="https://bria-datasets.s3.us-east-1.amazonaws.com/Liza/hq-RlUr_t6xqVk8j7HU7G_2a39319420e6403f9d4e01c70beaa076.png" width="300" style="border-radius: 8px;"> </td> </tr> </table>
post/erase_by_text

Request

  • Base URL: https://engine.prod.bria-api.com/v2/image/edit
  • URL: https://engine.prod.bria-api.com/v2/image/edit/erase_by_text
  • Auth: API key in header api_token

Request body

imagestring required

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.

object_namestring required

The name of the object to remove (e.g., "the lamp").

compositeboolean

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.
syncboolean

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.
webhook_urlstring uri

Optional URL for receiving the result via webhook when the async job completes. See webhooks.

prompt_content_moderationboolean

When enabled, applies content moderation to object_name.

Expected behavior:

  • Processing stops if object_name fails moderation.
  • Returns a 422 error with details about which parameter failed.
visual_input_content_moderationboolean

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.
visual_output_content_moderationboolean

When enabled, applies content moderation to result visual.

Expected behavior:

  • If the modified image fails moderation, returns a 422 error.

Response

Successful operation (Synchronous Success)

request_idstring required

Changes

    • breaking

      request body became required

    • breaking

      the request property's minLength was increased from 0 to 1

    • breaking

      removed the required property / from the response with the status

    • breaking

      removed the required property / from the response with the status

    • warning

      removed the optional property from the response with the status

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • warning

      deleted the header request parameter api_token

    • info

      api tag Editing added

    • info

      api tag v2 endpoints removed