v1

latestOpenAPI 3.0.02026-07-13650400.5 KB
Image Editing

Generative Fill

Description

The GenFill Route enables the generation of objects by prompt in a specific region of an image.

You can define the area for object generation by using a mask that outlines the region where the object will be created. Our model is optimized to work seamlessly with blob-shaped masks.

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

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-Generative-Fill-API" target="_blank">here</a>.

post/gen_fill

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 in which the object will be generated. If both mask_url and mask_file are provided, mask_url will be used. Accepted formats are jpeg, jpg, png, webp. The area in which the object will be generated 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 in which the object will be generated, in base64 format. This parameter is used if mask_url is not provided. Accepted formats are jpeg, jpg, png, webp. The area in which the object will be generated 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'.

promptstring

The prompt you would like to use to generate the object within the masked region.

negative_promptstring

The prompt you would like to use to specify details or attributes to avoid in the object generated within the masked region.

num_resultsinteger

The number of images you would like to generate.

syncboolean

Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false.

seedinteger

You can choose whether you want your generated results to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.

Response

Successful operation.

urlsstring[]

An array of URLs representing the updated visuals generated by the request. These URLs are temporary and will eventually expire.

seedinteger[]

An array of integers representing the seeds used to generate each result. These seeds ensure reproducibility and are compatible with the results URL structure.

Example response

{
  "urls": [
    "RESULT_URL_1",
    "RESULT_URL_2"
  ],
  "seed": [
    12345,
    67890
  ]
}