openBGremover / Docs

Remove backgrounds

Create a transparent cutout, resize the output, or return a mask.

POST /api/v1/remove-background

Request

Send a JSON object containing base64 image data. Only image_data is required. For original-byte uploads with defaults, see the quickstart.

{
  "image_data": "<base64 image>",
  "format": "png",
  "return_mask": true,
  "resize_options": { "max_width": 1400, "max_height": 1400 }
}
FieldValuesDefault
image_dataBase64 image, optionally a data URLRequired
formatpng, webp, gif, jpg, jpegpng
qualityauto, quality, portrait, product, speedauto
return_maskBoolean, static images onlyfalse
resize_optionsTarget or maximum dimensionsOriginal dimensions

Quality names are accepted presets for the same matting model. They do not select different models.

Resizing

Use max_width and max_height to constrain dimensions, or width and height to choose a target size. keep_aspect defaults to true. Output dimensions are capped at 8192 per side and 25 million pixels.

Output

PNG and WebP preserve soft transparency. Fully transparent pixels carry no colour, so the removed background cannot be recovered from the cutout. JPEG composites the result against white. Animated inputs produce GIF output. A mask, when requested for a static image, is a PNG returned in mask_image.

JSON responses include success, result_image, processing_time_ms, and metadata. Decode result_image from base64 to save it. Accept: image/* requests image bytes directly, unless you request a mask, which keeps the JSON image-and-mask response.

See responses for both delivery formats and limits before accepting uploads.

On this page