v1

latestOpenAPI 3.0.02026-07-13650400.5 KB
Image Editing

Eraser

Description

The Eraser Route enables the removal of elements or specific areas from a given image.

You can define the area to be removed by providing a mask that outlines the region to be erased. There are two main ways recommended to generate these masks:

  1. Masks can be created by allowing users to draw directly on the image with a brush, for example. To access the SDK that demonstrates how to implement a brush feature in your interface, please refer to the following <a href="https://github.com/Bria-AI/js-api-sdk/blob/main/manual_brush_ui" target="_blank">link</a>.
  2. By using the /objects/mask_generator route, which will generate all the possible masks for an image.

This capability is powered by our fast ControlNet inpainting model. HF model card is available <a href="https://huggingface.co/briaai/BRIA-2.3-ControlNet-Inpainting" target="_blank">here</a>, and the HF demo space can be found <a href="https://huggingface.co/spaces/briaai/BRIA-2.3-ControlNet-Eraser-API" target="_blank">here</a>

Additionally, ComfyUI nodes that enable running this API route can be found <a href="https://github.com/Bria-AI/ComfyUI-BRIA-API" target="_blank">here</a>

post/eraser

Headers

api_tokenstring required

Request body

image_urlstring

The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp.

filestring

The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp.

mask_urlstring

The URL of the binary mask image that represents the area that will be cleaned. If both mask_url and mask_file are provided, mask_url will be used. Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black). Note: The input image and mask must have the same aspect ratio.

mask_filestring

The file of the binary mask image that represents the area that will be cleaned, in base64 format. This parameter is used if mask_url is not provided. Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black). Note: The input image and mask must have the same aspect ratio.

mask_type'manual' | 'automatic'

You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.

Response

Successful operation.

result_urlstring

URL that represents the updated visual created in the request. It is a temporary URL that will expire

Example response

{
  "result_url": "URL"
}