Skip to main content

Remove Background

POST 

/v1/remove-background

Removes the background from an image and optionally adds AI-generated shadows, crops to the subject, and applies margins. When AI shadows are requested, an additional 3 credits will be consumed.

Input Image Limits:

  • Max size: 25MB
  • Min resolution: 64x64px
  • Max resolution: 6000x6000px

Request

Header Parameters

    Accept string

    Acceptable response media type(s). application/json or image/*. Default is application/json.

Body

    image_url urlrequired

    URL of the image to be processed.

    format string

    Possible values: [png]

    The format of the resultant image. Currently, only png is supported.

    shadow

    ShadowParameter

    Enable and configure AI-generated shadow. When enabled, +3 credits are consumed. Pass true for automatic shadow estimation or provide a light source for custom control.

    enabled booleanrequired

    Enable AI shadow rendering.

    opacity float

    Possible values: <= 1

    Default value: 0.5

    Final composited shadow opacity (0–1).

    light_source

    object

    Virtual light used to synthesize the shadow. x/y are normalized to image center (-1..1); z is height above subject (0..2).

    size floatrequired

    Possible values: <= 1

    Default value: 0.3

    Apparent emitter size/softness. Higher = softer penumbra.

    position

    object

    required

    x floatrequired

    Possible values: >= -1 and <= 1

    Default value: -0.3

    y floatrequired

    Possible values: >= -1 and <= 1

    Default value: -0.6

    z floatrequired

    Possible values: <= 2

    Default value: 0.7

    crop CropParameter (boolean)

    When true, crops the image to the region of interest (the detected subject).

    margin MarginParameter (string)

    (Beta) General margin applied to all sides when crop is enabled. Only applies if crop is true. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).

    margin_left DirectionalMarginParameter (string)

    (Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).

    margin_right DirectionalMarginParameter (string)

    (Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).

    margin_top DirectionalMarginParameter (string)

    (Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).

    margin_bottom DirectionalMarginParameter (string)

    (Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).

Responses

Success

Schema

    result_url string

    A URL to access the resultant image which is valid for 1 hour. File format will be png.

Loading...