Slazzer auto background removal API

Remove image background with just a single API call
curl -H 'API-KEY: YOUR_SLAZZER_API_KEY'
           -F '[email protected]_image_path'
           -f https://api.slazzer.com/v2.0/remove_image_background
           -o output.png

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 here

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 don't 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 and 'png' for PNG format. 'png' format support alpha transparency.

  • 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)

  • 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 consider as a foreground and everything else will be consider 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.

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 1200 images per hour via the API, but depending on the input image megapixel resolution.

Duration Rate Limit Input image size
Per Day Max 20 x 60 x 24 = 28800 images Upto 25 MP
Per Hour Max 20 x 60 = 1200 images Upto 25 MP
Per Minute Max 20 x 1 = 20 images Upto 25 MP

Error code 429 will return if api rate limit exceed & no credit will be charged.

Higher api rate limit are available for enterprise customers. Contact Us