Remove the background
/v1/background/removeSend one photo by URL, base64 or file upload. format: json (default) returns a
PNG data URI plus the size, the subject's bounding box and how much of the image
it covers; png, webp and jpeg return the image bytes.
background is transparent or a colour such as #FFFFFF (JPEG needs a colour).
crop: true trims to the subject, with padding pixels around it; max_size sets
the longest side of the output. Choose quality: best for detail or fast for previews.
More examples and contract notes
More examples
Transparent PNG file
{
"image": {
"url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
},
"format": "png"
}
Product photo on white, cropped (JPEG)
{
"image": {
"url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
},
"format": "jpeg",
"background": "#FFFFFF",
"crop": true,
"padding": 40
}
Fast WebP thumbnail
{
"image": {
"url": "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
},
"format": "webp",
"quality": "fast",
"max_size": 512
}
Body parameters
cropbooleanCrop the result to the subject's bounding box.
falsepaddingintegerPixels kept around the subject when `crop` is true.
0min 0max 1000max_sizeintegerLongest side of the output in pixels (default: original, at most 4096).
nullmin 64max 4096qualitybest · fastbest (default) prioritizes detail; fast is suitable for previews. Compare both on your own images.
"best"formatjson · png · webp · jpeg`json` returns metadata plus a PNG data URI; `png`/`webp` return the image bytes; `jpeg` needs an opaque `background`.
"json"backgroundstring`transparent`, or a colour `#RRGGBB` to place the subject on.
"transparent"imageobjectREQUIRED2 child fields
urlstringPublic http(s) URL of the image (≤ 20 MB). Private and internal addresses are refused.
nullmax length 2048base64stringThe image as base64 (a `data:` URI is fine), ≤ 20 MB decoded.
nullmax length 27962090filebinaryREQUIREDThe image (PNG, JPEG, WebP, GIF, BMP or TIFF; ≤ 20 MB)
cropbooleanCrop the result to the subject's bounding box.
falsepaddingintegerPixels kept around the subject when `crop` is true.
0min 0max 1000max_sizeintegerLongest side of the output in pixels (default: original, at most 4096).
64max 4096qualitybest · fastbest (default) prioritizes detail; fast is suitable for previews. Compare both on your own images.
"best"formatjson · png · webp · jpeg`json` returns metadata plus a PNG data URI; `png`/`webp` return the image bytes; `jpeg` needs an opaque `background`.
"json"backgroundstring`transparent`, or a colour `#RRGGBB` to place the subject on.
"transparent"Responses
The result: JSON (metadata + PNG data URI) or the image bytes, per `format`
formatstringREQUIREDEncoding of `data_uri`
media_typestringREQUIREDwidthintegerREQUIREDOutput width in pixels
heightintegerREQUIREDOutput height in pixels
bytesintegerREQUIREDdata_uristringREQUIRED`data:<media_type>;base64,…`
bboxobjectREQUIRED4 child fields
xintegerREQUIREDyintegerREQUIREDwidthintegerREQUIREDheightintegerREQUIREDforeground_rationumberREQUIREDShare of the original image covered by the subject (0–1)
qualitybest · fastREQUIREDbest (default) prioritizes detail; fast is suitable for previews. Compare both on your own images.
Binary response body.
Binary response body.
Binary response body.