通过 CometAPI 使用 Bria 图像编辑 API,使用 POST /bria/image/edit/ 擦除、gen_fill、扩展、增强、放大或替换背景。
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 通过查询状态端点查询结果。此接口中的 sync 参数是固定的——你无需指定它。| Operation | Description | Documentation |
|---|---|---|
erase | 从图像中移除对象 | Bria Erase 文档 |
gen_fill | 对遮罩区域进行生成式填充 | Bria Gen Fill 文档 |
expand | 扩展图像画布 | Bria Expand 文档 |
enhance | 增强图像质量 | Bria Enhance 文档 |
increase_resolution | 提升图像分辨率 | Bria Upscale 文档 |
replace_background | 替换图像背景 | Bria Background 文档 |
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"
}
'{}