Background Removal API

Remove image background with just a single API call

Home Page Banner Image
curl -H 'API-KEY: YOUR_SLAZZER_API_KEY'
           -F 'source_image_file=@source_image_path'
           -f https://api.slazzer.com/v2.0/remove_image_background
           -o output.png
Get API Key

Our AI will remove the background from any image that has a clear foreground and background. (tested with human, cars, animals, & products )

Check out our sample code

Remove background from image file

Environment

SLAZZER - SDK

Check out the official android library

Check out the official android libraryhere

Output Formats

Easily request any one of the 2 formats via our format parameter
Format Resolution
png
  • Upto 10 MP , Ex - 3872 x 2592
jpg
  • Upto 25 MP , Ex - 6250 x 4000

*Please note that PNG images above 10 megapixels are not supported by default. If you do not require transparency we recommend using the JPG format.

API Reference

Server URL:https://api.slazzer.com/v2.0

Request Body:multipart/form-data

Method:POST

API:/remove_image_background

Authorization
  • API-KEY
    string

    Your API key

Parameters Request body
  • source_image_file
    string($binary)

    Source image file. Support only PNG, JPG, JPEG.

    *** use only one source_image_ parameters at a time

  • source_image_url
    string

    Source image url. Support only PNG, JPG, JPEG.

    *** use only one source_image_ parameters at a time

  • source_image_base64
    string

    Source image base64 format. Support only PNG, JPG, JPEG.

    *** use only one source_image_parameters at a time

  • bg_image_file
    string($binary)

    This binary image file will be placed as a background of the output binary image. This image will be resized according to the output image aspect ratio. supported bg_image_file formats are `png`, `jpg`, `jpeg`.

    *** use only one bg_parameters

  • bg_image_url
    string

    This image from the url will be placed as a background of the output binary image. This image will be resized according to the output image aspect ratio. supported bg_image_url formats are `png`, `jpg`, `jpeg`.

    *** use only one bg_parameters

  • bg_image_base64
    string

    This image from the base64 string will be placed as a background of the output binary image. This image will be resized according to the output image aspect ratio. supported bg_image_base64 formats are `png`, `jpg`, `jpeg`.

    *** use only one bg_parameters

  • bg_color_code
    string

    Output with solid background color. Has to be HEX color code. (e.g. #72E4B3, #B3D472).

    *** Please Note: Add '#' before color code.

    *** use only one bg_parameters

  • format
    string

    Output image format. Default value `png`. Otherwise, `jpg` for JPG format (no transparency) and `png` for PNG format. `png` format support alpha transparency. "zip" for ZIP format, contains color image and alpha matte image.

  • crop
    boolean

    Default value: false. It will crop all extra transparent pixels

  • crop_margin
    int

    This parameter only work when crop applied (crop=True). Default value of this parameter is 0px. it supports input value in the following ways

    Ex. 20px - create margin all around the subject.
    Ex. 12% - create margin all around the subject with respect to the subject size.
    Ex. 10px,20px - create 10px margin left and right side, 20px margin top and bottom side.
    Ex. 10%,20% - create 10% margin left and right side, 20% margin top and bottom side with respect to the subject size.
    Ex. 10px,20px,18px,24px - create 10px margin left, 20px margin top, 18px margin right and 24px margin in bottom.
    Ex. 10%,20%,18%,24% - create 10% margin left, 20% margin top, 18% margin right and 24% margin in bottom with respect to the subject size.
    crop_margin parameter support max 500px or max 50% of the subject size.

  • scale
    string

    This parameter scales the subject in the output image. Can be any range between 10% or 100% depending on the image dimensions. Default position parameter value is `center`, unless any other position parameter value is given.

  • position
    string

    This parameter place the subject within the image canvas. Only works when `scale` parameter is given. Default value is `center`. Can be a single value between 0% to 100%(horizontal and vertical) or two values between 0% to 100% separated by comma(eg: 10%,18%) both horizontal and vertical.

  • preview
    boolean

    Default value: false. If true it will resize image to 0.25 megapixel. (eg value: 400x600 pixels) 0.20 credit will be charged per preview image. 1 credit will be charged if value set to false

  • channel
    string

    This parameter will return the image channel(red, green, blue, alpha) in RGBA or alpha mask format. `rgba` is the default parameter, returns alpha mask when value is set to `alpha`.

  • roi
    string

    This parameter when given will let you extract the region of interest of a particular image, only the contents of the selected rectangular will be considered as a foreground and everything else will be considered as background and will be completely removed.
    ex. 200px,320px,400px,230px   -    top-left,bottom-right coordinates.
    ex. 10%,15%,25%,30%   -    top-left,bottom-right with respect to the image size.

  • car_shadow
    boolean

    Should an artificial shadow be included in the output (default: true). Please note that currently, the addition of shadows is limited to car photos. For other subjects, shadows will not be applied, even if set to true (though this may change in the future).

Response
  • Code : 200

    Successfully removed image background

    Binary image data
  • Code: 400

    Error: Invalid parameters or unable to process input image file (No credit deducted)

    Example :

    {
        "error": "Source image file not found"
    }
  • Code: 401

    Error: API-KEY missing or invalid API-KEY (No credit deducted)

    Example :

    {
        "error": "invalid api key"
    }
  • Code: 402

    Error: No credits remaining (No credit deducted)

    Example :

    {
        "error": "No credits remaining"
    }
  • Code: 429

    Error: Api rate limit crossed (No credit deducted)

    Example :

    {
        "error": "Api rate limit crossed"
    }

Credit API Reference

Server URL:https://api.slazzer.com/v2.0

Request Body:multipart/form-data

Method:POST

API:/account

Parameters Request body
  • api_key
    string

    Your API key

Response
  • Code : 200

    Successfully fetched credit details

    {
        "subscription_plan_credits": XXX,
        "topup_plan_credits": XXX,
        "earn_credits": XXX
        "total_credits": XXX
    }

API Rate Limit

You can instantly process upto 500 images per minute via the API, but depending on the input image megapixel resolution.
Input image Megapixels Rate Limit approx
625 x 400 1 MP 500 images per minute
1200 x 800 1 MP 500 images per minute
1600 x 1200 2 MP 250 images per minute
2500 x 1600 4 MP 125 images per minute
4000 x 2500 10 MP 50 images per minute
6250 x 4000 25 MP 20 images per minute
Error code 429 will return if api rate limit exceed & no credit will be charged.
Higher api rate limits are available for enterprise customers. Contact Us