Remove background

Remove or Replace the Background of One Image - Endpoint

POST https://alto.tchek.fr/apiV1/remarketing​/removeBackground

Enables the removal or replacement of the background in a car image.

Request Body

Name
Type
Description

url

Object

example: https://www.automobile-magazine.fr/asset/cms/800x449/167149/config/115964/peugeot-208.jpg

urlBackground

String

The URL of the new background image, if specified.

manualWidthRatio

Float

The ratio of the vehicle size compared to the background. The bigger the ratio, the bigger the vehicle will appear.

autoCenter

Boolean

Automatically positions the vehicle at the center of the image.

manualPositioning

Boolean

Enables the manualTopLeftPositionRatio parameter, read next.

manualTopLeftPositionRatio

Array

The list of floats corresponding to the top-left position of the vehicle against the background (x,y). More details below

wheelBox

Array

Legacy - not recommended. The coordinates of the position of the wheels in the background. More details below.

colorBackground

String

The Hexa color code of the new monochrome background, if specified.

blurFace

Boolean

If true, blur any faces on the picture.

blurLogo

Boolean

If true, blur any logos on the picture.

blurLicencePlate

Boolean

If true, blur any licence plates on the picture.

{
  "url": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/carToRemarket.jpg",
  "urlBackground": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/TchekBackground.jpg",
  "blurLicencePlate": true,
  "autoCenter": true,
  "manualWidthRatio": 0.7
}

Response

{
  "id": "30a3c50c0ae02d4c",
  "path": "https://apidetection.prod.tchek.fr/public/remarketing/20250121084621781.jpg",
  "status": "success"
}

Transparent Background

If you want to remove the background and get the vehicle as a PNG file with no background, you simply need to leave out the urlBackground and colorBackground parameters in your API call. This will allow you to obtain the vehicle image without any background, making it easy to use in your application or integrate into your workflow.

Example :

{
  "url": "https://www.automobile-magazine.fr/asset/cms/800x449/167149/config/115964/peugeot-208.jpg",
  "blurFace": true,
  "blurLogo": true,
  "blurLicencePlate": true
}

Color Background

If you want to add a specific color background to the image and get the result in a JPEG file, specify the desired color using the colorBackground parameter. Simply provide the desired hex code for the desired background color.

Example :

{
  "url": "https://www.automobile-magazine.fr/asset/cms/800x449/167149/config/115964/peugeot-208.jpg",
  "colorBackground": "#E2E5DE",
  "blurFace": true,
  "blurLogo": true,
  "blurLicencePlate": true
}

Replace background and place the vehicle anywhere against it

In order to change the background, you need to specify the urlBackground parameter. Depending on where you want to place the cropped image of the vehicle, you can use different parameters:

  • manualWidthRatio (Float): the ratio of the vehicle size compared to the background. The bigger the ratio, the bigger the vehicle will appear.

  • autoCenter (boolean): automatically positions the vehicle at the center of the image.

  • manualPositioning (boolean): enables the manualTopLeftPositionRatio parameter, read next

  • manualTopLeftPositionRatio (list of two floats): defines the top-left position of the vehicle against the background (x,y).

How to position the cropped image at the CENTER of the new background

By using the autoCenter boolean, you can center the vehicle against the background. Please find the cURL of an exemple:

curl -X 'POST' \
  'https://alto.tchek.fr/apiV1/remarketing/removeBackground' \
  -H 'accept: application/json' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/carToRemarket.jpg",
  "urlBackground": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/TchekBackground.jpg",
  "blurLicencePlate": true,
  "autoCenter": true,
  "manualWidthRatio": 0.7
}'

And the result:

How to position the cropped image ANYWHERE on the new background

By using the manualPositioning boolean along with the manualWidthRatio and the manualTopLeftPositionRatio (list of two floats) , you can define the top-left position of the vehicle against the background.

In particular, the manualTopLeftPositionRatio defines the position of the top-left corner of the cropped image on the x and y coordinates. As such, [0,0] means the top left corner of the cropped image will be placed as close to the top-left corner of the background as possible.

So, for instance, if we want to place the car near the the top-left corner, but we want to add a little margin both on the side and the top, we may enter:

curl -X 'POST' \
  'https://alto.tchek.fr/apiV1/remarketing/removeBackground' \
  -H 'accept: application/json' \
  -H 'X-API-Key: f520ba00d5a0f9efcfeb345715684a56e67e94080c981d34bc47ed1864c3' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/carToRemarket.jpg",
  "urlBackground": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/TchekBackground.jpg",
  "blurLicencePlate": true,
  "manualPositioning": true,
  "manualTopLeftPositionRatios": [
    0.1,
    0.1
  ],
  "manualWidthRatio": 0.7
}'

And here is the result:

To place the car on the center-bottom , use

curl -X 'POST' \
  'https://alto.tchek.fr/apiV1/remarketing/removeBackground' \
  -H 'accept: application/json' \
  -H 'X-API-Key: YOUR_API_KEY_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/carToRemarket.jpg",
  "urlBackground": "https://tchek-images.s3.eu-west-3.amazonaws.com/swagger/TchekBackground.jpg",
  "blurLicencePlate": true,
  "manualPositioning": true,
  "manualTopLeftPositionRatios": [
    0.2,
    0.3
  ],
  "manualWidthRatio": 0.7
}'

And here is the result:

Wheelbox positioning (legacy) You can also specify the position of the wheels in the background of your choice by using the wheelsBox values as described below : {wheelsBox : [ x1, y1, x2, y2 ]}

Example :

{
  "url": "https://www.automobile-magazine.fr/asset/cms/800x449/167149/config/115964/peugeot-208.jpg",
  "urlBackground": "https://www.ondemandcmo.com/wp-content/uploads/2012/09/Background-Fade1.jpg",
  "wheelsBox": [
    0.1, 0.3, 0.9, 0.9
  ],
  "blurFace": true,
  "blurLogo": true,
  "blurLicencePlate": true
}

We however recomment using the manualPositioning" boolean along with the manualWidthRatio and the manualTopLeftPositionRatio to define the top-left position of the vehicle against the background.

Last updated

Was this helpful?