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

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

Thời gian xử lý trung bình

Cho mỗi yêu cầu.

Thời gian xử lý
≈ 0,425 giây

Yêu cầu đầu vào

Hình ảnh

Định dạng
JPEG, PNG, WEBP
Độ phân giải tối đa
3000 × 3000 px
Xem tất cả yêu cầu đầu vào

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