# Remove background

### Remove or Replace the Background of One Image - Endpoint

<mark style="color:green;">`POST`</mark> `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   | <p>The list of floats corresponding to the top-left position of the vehicle against the background (x,y).<br>More details below</p> |
| wheelBox                   | Array   | <p>Legacy - not recommended.<br>The coordinates of the position of the wheels in the background. More details below.</p>            |
| 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.                                                                                    |

{% tabs %}
{% tab title="200: OK " %}
```json
{
  "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
}
```
{% endtab %}
{% endtabs %}

#### 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.&#x20;
* **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).

### &#x20;**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:&#x20;

```
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:

![](https://t2175885.p.clickup-attachments.com/t2175885/9204578c-8056-43a9-be62-e11c4197d7ec/image.png)\


### **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.&#x20;

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:

![](https://t2175885.p.clickup-attachments.com/t2175885/392fd08e-86d3-40b9-be5e-f1def83b36e7/image.png)



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:

![](https://t2175885.p.clickup-attachments.com/t2175885/a31a10d7-eb9f-4ae1-ba65-93176e1861c8/image.png)

\
\


**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 ]}`



<figure><img src="https://916648582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MeFNfeEGo5wOjXKgrXG%2Fuploads%2FpbJQOryPXURJm8r1Ok2c%2Fimage.png?alt=media&#x26;token=73db8eda-2f99-459d-a167-c6069ed84f6a" alt=""><figcaption></figcaption></figure>

_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.
