Remove background

API Documentation

Get started

  1. Sign up
  2. Get your
    API key
  3. Review the documentation to work with API

API information

Sending requests with size: "full" parameter will decrease your balance
Server
https://benzin.io/api/removeBackground
Request type
POST
Using algorithms of neural network automatically removes background from any image
  • File size: up to 32 MB
  • Image source: File upload (binary or as base64 string) or by URL
  • Any images are available for processing
  • Output resolutions: Preview, Full - original image resolution
  • Requires X-Access-Token header
Request Body
  • Parameter
  • size
    (string)
    Returned image size.
    Available values:
    "full", "preview".
    Default:
    preview
  • channels
    (string)
    Returned image channels: color image, or mask.
    Available values:
    "rgba", "alpha".
    Default:
    rgba
  • crop
    (boolean)
    If true, the image will be cropped along the border of the recognized object.
    Available values:
    true, false
    Default:
    false
  • crop_margin
    (string)
    Defines the offsets from the edges of the cropped image, works only if crop = true, the value could be set in pixels (10px), or in percent (10%), it is possible to set both one value for all edges (for example: 25%), and for paired edges (for example: 10%, 100px), the first value is the left and right edge, the second value is the top and bottom, you can also set all edges separately, e.g. 10%, 25px, 25%, 33%
  • output_format
    (string)
    The format that data will be returned.
    Available values:
    "image" - in the form of an image (image/*), "json" - image will be encoded in base64 (application/json)
    Default:
    image
  • output_image_format
    (string)
    The format of the returned image.
    Available values:
    png, jpg, webp
    Default:
    png
  • image_file
    (binary)
    Image for processing in binary form
    (Use only in multi-part/form-data)
  • image_file_b64
    (string)
    Image for processing in base64 format
    Default:
    none
  • image_file_url
    (string)
    Image for processing by URL
    Default:
    none
  • bg_color
    (string)
    New background color. Can be specified by color name (white, blue) or by rgb (#fff)
    Default:
    none
  • bg_image_file
    (binary)
    New background with a picture in binary form
    (Use only in multi-part/form-data)
  • bg_image_file_b64
    (string)
    New background image in base64 format
    Default:
    none
  • bg_image_file_url
    (string)
    New background image by URL
    Default:
    none

Responses

  • Code
    Description
  • 200
    Response if output_format: "image" - binary stream;
    Response if output_format: "json" -
    { "image_height": 'val', "image_raw": base64 code, "image_type": "png", "image_width": 'val' }
  • 400
    Error: Invalid parameters or input file can`t be processed.
    Example: missing image in request
    { "error": "missing image" }
    Example: header X-Access-Token isn`t set and you want to get size: "full" image
    { "error": "Token not set" }

Request examples

Our website uses cookies:
Learn more
All images are processed!