Sử dụng API Chỉnh sửa hình ảnh Bria qua CometAPI để erase, gen_fill, expand, enhance, upscale hoặc thay thế nền bằng POST /bria/image/edit/.
curl --request POST \
--url https://api.cometapi.com/bria/image/edit/{action} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "https://raw.githubusercontent.com/cometapi-dev/.github/refs/heads/main/assets/img/original_image.png",
"mask": "https://raw.githubusercontent.com/cometapi-dev/.github/refs/heads/main/assets/img/mask_image.png"
}
'{}request_id được trả về để truy vấn kết quả qua endpoint Query Status.Tham số sync được cố định trên giao diện này — bạn không cần chỉ định nó.| Operation | Description | Documentation |
|---|---|---|
erase | Xóa đối tượng khỏi hình ảnh | Bria Erase Docs |
gen_fill | Tô sinh tạo cho các vùng được mask | Bria Gen Fill Docs |
expand | Mở rộng canvas hình ảnh | Bria Expand Docs |
enhance | Cải thiện chất lượng hình ảnh | Bria Enhance Docs |
increase_resolution | Tăng độ phân giải hình ảnh | Bria Upscale Docs |
replace_background | Thay thế nền hình ảnh | Bria Background Docs |
Bearer token authentication. Use your CometAPI key.
Must be application/json.
Editing action to perform. Supported values: erase, gen_fill, expand, enhance, increase_resolution, replace_background.
Source image as a public URL or base64-encoded data URI. Accepted formats: JPEG, PNG, WebP. Maximum 12 MB.
Mask image as a public URL or base64. White areas mark the region to edit; black areas are preserved. Required for erase, gen_fill, and expand actions.
Text description of the desired edit. Required for gen_fill and replace_background actions.
Number of result variants to generate. Default: 1.
When true, the response blocks until results are ready. When false (default), returns immediately with placeholder URLs that can be polled.
Success
The response is of type object.
curl --request POST \
--url https://api.cometapi.com/bria/image/edit/{action} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"image": "https://raw.githubusercontent.com/cometapi-dev/.github/refs/heads/main/assets/img/original_image.png",
"mask": "https://raw.githubusercontent.com/cometapi-dev/.github/refs/heads/main/assets/img/mask_image.png"
}
'{}