Background Remover
POST https://api.vidu.com/ent/v2/remove-bg
Request Header
Field | Value | Description |
---|---|---|
Content-Type | application/json | Data Exchange Format |
Authorization | Token {your api key} | Replace {} with your API key |
Request Body
Field | Type | Required | Description |
---|---|---|---|
image | String | Required | Image input parameter, used to generate the final product image output. Supported formats and requirements: - Only one image can be uploaded - Accepts image URL (must be publicly accessible) or Base64 format - Supported formats: png, jpeg, jpg, webp - Image width and height must each be at least 512 pixels - Aspect ratio must be less than 2 - Image file size must not exceed 10 MB - The length of the base64 decode must be under 10MB, and it must include an appropriate content type string. For instance,
|
count | Int | Required | Number of output images. Default is 4, acceptable range: 1–4 |
background | String | Optional | Background preset parameter: - Used to specify a predefined background - Either background or custom_background must be provided; only one of them can be used at a time- - See full list of options: Background Enum doc |
custom_background | String | Optional | Custom background parameter: - Used to specify a background color in hexadecimal format, e.g. #ced2ce for a light gray background - Only one of background or custom_background can be provided per request; they cannot be used simultaneously |
callback_url | String | Optional | Callback When creating a task, you need to actively set the callback_url with a POST request. When the video generation task changes its status, Vidu will send a callback request to this URL, containing the latest status of the task. The structure of the callback request content will be the same as the return body of the GET Generation API. The “status” in the callback response includes the following states: - processing: Task is being processed. - success: Task is completed (if sending fails, it will retry the callback three times). - failed: Task failed (if sending fails, it will retry the callback three times). |
curl -X POST -H "Authorization: Token {your_api_key}" -H "Content-Type: application/json" -d '{"background": "white","image": "input_your_image_url","count": 4}' https://api.vidu.com/ent/v2/remove-bg
Response Body
Field | Type | Description |
---|---|---|
task_id | String | Task ID |
state | String | It will be returned to a specific processing state: - created created task successfully - queueing task in queue - processing processing - success generation successful - failedtask failed |
image | String | The image used for this call |
count | Int | The images count used for this call |
background | String | The background parameter used in this call |
custom_background | String | The custom background parameter used in this call |
created_at | String | Task creation time |