Skip to main content
Image erase completion

Image erase completion — Create a task

Erase people, objects, text, or watermarks from an image and fill in the area

POST
/services/aigc/image2image/image-synthesis
cURL
# China North 2 (Beijing). This model is available only in this region.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
curl --request POST \
  --url https://cn-beijing.maas.qwencloudapi.com/api/v1/services/aigc/image2image/image-synthesis \
  --header 'X-DashScope-Async: enable' \
  --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "image-erase-completion",
  "input": {
    "image_url": "https://example.com/input.png",
    "mask_url": "https://example.com/mask.png"
  },
  "parameters": {
    "dilate_flag": true
  }
}'
{
  "output": {
    "task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1",
    "task_status": "PENDING"
  },
  "request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51"
}
image-erase-completion removes one or more elements from an image, such as people, pets, objects, text, or watermarks, and fills in the erased area while preserving the background. Use mask_url to mark the area to erase and, optionally, foreground_url to protect an area from being changed. Supported regions: China North 2 (Beijing) only. Use an API key created in that region and the https://cn-beijing.maas.qwencloudapi.com endpoint. See Regions and endpoints.
The model is available for free trial only. After the free quota is used, calls are no longer possible. As an alternative, use Image editing.
Processing is asynchronous: this operation returns a task_id, and you poll Query the result until the task finishes.

Authorizations

string
header
required

QwenCloud API key. See API keys.

Header Parameters

enum<string>
default"enable"
required

Must be set to enable to submit the task asynchronously.

enable

Body

application/json
enum<string>
required

Model name. Fixed to image-erase-completion.

image-erase-completion
object
required
object

Response

200-application/json
string

Unique request identifier.

object