SnapeditAPI
Đăng nhậpBắt đầu miễn phí
Đăng nhập
API Reference

Remove background from image

Remove the background from an image. By default, returns the foreground as an RGBA image. Set output_type to mask to return the foreground mask instead.

Model:remove-background
Credit:1
post/v1/images/remove-background

AuthorizationThis endpoint requires an API key. Pass it in the api-key header on every request. Learn more

Parameters

NameTypeStatusDescription
input_image
fileRequiredImage file or URL to remove the background from.
output_type
stringOptionalChoose foreground to return the foreground RGBA image, or mask to return the foreground mask.
foregroundmask
(default: foreground)

Responses

Background removed successfullyRemoveBackgroundResponse

FieldTypeDescription
dataobject[]
urlstringURL to download the selected result image
boxnumber[]Bounding box [x1, y1, x2, y2] of foreground object
curl -X POST "https://api.snapedit.app/v1/images/remove-background" \
  -H "api-key: YOUR_API_KEY" \
  -F "input_image=@./image.jpg" \
  -F "output_type=foreground"
Response
{
  "data": [
    {
      "url": "https://outputs.snapedit.app/outputs/abc123.png",
      "box": [
        10,
        20,
        300,
        400
      ]
    }
  ]
}

Examples (2 examples)

Input

Input 1

Output Foreground

Output

Output Mask

Output Mask