跳轉到主要內容
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 的 Image Editing API 提供一套完整的工具,可用於操作與增強影像。
API 呼叫成功後,請使用回傳的 request_id 透過 查詢狀態 端點查詢結果。此介面的 sync 參數為固定值 —— 你不需要另外指定。

支援的操作

OperationDescriptionDocumentation
erase從影像中移除物件Bria Erase Docs
gen_fill對遮罩區域進行生成式填補Bria Gen Fill Docs
expand擴展影像畫布Bria Expand Docs
enhance提升影像品質Bria Enhance Docs
increase_resolution提高影像解析度Bria Upscale Docs
replace_background替換影像背景Bria Background Docs
請參閱官方文件,以取得各操作對應的參數清單。

授權

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.