跳转到主要内容
POST
/
bria
/
image
/
edit
/
{action}
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" } '
{}

概述

Bria 的图像编辑 API 提供了一套全面的工具,用于处理和增强图像。
API 调用成功后,请使用返回的 request_id 通过查询状态端点查询结果。此接口中的 sync 参数是固定的——你无需指定它。

支持的操作

OperationDescriptionDocumentation
erase从图像中移除对象Bria Erase 文档
gen_fill对遮罩区域进行生成式填充Bria Gen Fill 文档
expand扩展图像画布Bria Expand 文档
enhance增强图像质量Bria Enhance 文档
increase_resolution提升图像分辨率Bria Upscale 文档
replace_background替换图像背景Bria Background 文档
请参考官方文档,查看各操作对应的具体参数列表。

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求头

Content-Type
string

Must be application/json.

路径参数

action
string
必填

Editing action to perform. Supported values: erase, gen_fill, expand, enhance, increase_resolution, replace_background.

请求体

application/json
image
string

Source image as a public URL or base64-encoded data URI. Accepted formats: JPEG, PNG, WebP. Maximum 12 MB.

mask
string

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.

prompt
string

Text description of the desired edit. Required for gen_fill and replace_background actions.

num_results
integer

Number of result variants to generate. Default: 1.

sync
boolean

When true, the response blocks until results are ready. When false (default), returns immediately with placeholder URLs that can be polled.

响应

200 - application/json

Success

The response is of type object.