All Products
Search
Document Center

:Smart erase

Last Updated:Sep 13, 2026

The smart erase feature is optimized for e-commerce images. It automatically identifies and removes text, specific names, transparent text blocks, and psoriasis-style ads. You can specify which objects to remove, enabling efficient and precise processing of large image batches and simplifying your editing workflow.

Use cases

  • Efficiently process e-commerce images: Remove distracting visual elements to create a cleaner, more focused product display and improve the shopping experience.

  • Synchronize product information across platforms: When listing products on different e-commerce platforms, you can quickly remove specific text and psoriasis-style ads to comply with each platform's image standards.

  • Prepare marketing materials: Easily remove old promotional information from images to update them with new campaign details.

Merchants and platforms can batch-remove unwanted elements to optimize image quality. For best results, use this service with smart element recognition. First, filter images that contain text, specific names, transparent text blocks, and psoriasis-style ads. Then, use the smart erase API to remove these elements in bulk. For scenarios that do not require removing all elements of a certain type (for example, removing only specific text), the service also allows you to input multiple text strings for batch removal.

smart element recognition focuses on "recognition," while smart erase focuses on "removal." Using them in sequence maximizes effectiveness and minimizes both false removals and missed detections. If you need to perform both steps and want a unified workflow, use smart layout.

Supported elements

Value

Description

Examples

1

transparent text block

Monochromatic transparent text or semi-transparent color blocks, typically used as watermarks.

2

specific name

Brand names, store names, and custom keywords.

3

text

Horizontal, vertical, or slanted text in Chinese and English.

4

psoriasis-style ads

Promotional copy, exaggerated decorative elements, and unofficial certification badges (including colored text blocks).

The server distinguishes between two areas: the image subject (the core product area) and the non-subject area (the background area other than the subject). ObjectRemoveElements controls the removal area on the subject, and NonObjectRemoveElements controls the removal area on the non-subject area. Both can be specified independently.

Additionally, you can use UserText or UserImage to precisely specify text or image elements for removal, or use Mask or Position to manually define the removal area for more granular control.

Features

  1. The service distinguishes between the image subject and the non-subject area. You can target elements for removal in either region.

    1. Image subject: The core product area in the image.

    2. Non-subject area: The rest of the image, excluding the subject.

  2. You can remove elements in one of three ways:

    1. Select element types for removal, such as text, specific names, transparent text blocks, and psoriasis-style ads.

    2. Provide images of the elements to remove. You can specify multiple images.

    3. Provide specific text to remove. You can specify multiple text strings.

Workflow: The user provides an image URL → An OCR and VLM model detects the positions of text or images → The service determines the coordinates for inpainting → AI inpainting generates a clean image → The service returns the URL of the result image.

Before and after

Text

Area

Source image

Output image

Overlaps with the image subject

image

image

Does not overlap with the image subject

image

image

Specific name

Area

Source image

Output image

Overlaps with the image subject

image

image

Does not overlap with the image subject

image

image

Transparent text block

Area

Source image

Output image

Overlaps with the image subject

image

image

Does not overlap with the image subject

image

image

Psoriasis-style ads

Area

Source image

Output image

Overlaps with the image subject

image

image

Does not overlap with the image subject

image

image

Specified objects

Type

Source image

Output image

Remove specified image elements (supports multiple image URLs)

image

image

Remove specified text (supports multiple text strings)

image

image

API

POST /rest/ai/image/remove

Quick start

import json

# Remove transparent text blocks, specific names, and psoriasis-style ads from the non-subject area only.
data = json.dumps({
    "ImageUrl": "https://example.com/product-with-watermark.jpg",
    "NonObjectRemoveElements": [1, 2, 4]
})
result = make_signed_request("/rest/ai/image/remove", data)

d = result["Data"]
print("Output image URL:", d["ImageUrl"])
print("Output dimensions:", d["Width"], "x", d["Height"])

For request signing instructions, SDK examples, and online debugging, see the smart erase API in the OpenAPI Developer Portal.

Request parameters

Parameter

Type

Required

Description

ImageUrl

String

Yes

The URL of the source image. Supported formats are JPG, JPEG, PNG, BMP, and WEBP. The resolution must be between 256×256 and 3000x3000 pixels, and the file size cannot exceed 10 MB.

Example: "https://ae01.alicdn.com/kf/S342f0070dc9f4be09a6cbed34e90dc8fs.jpg"

ObjectRemoveElements

Number[]

No

An array of element types to remove from the image subject (1 = transparent text block, 2 = specific name, 3 = text, 4 = psoriasis-style ads). You can select multiple types. For descriptions of each type, see the Supported elements section.

At least one of the following parameters must be provided: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage. If multiple parameters are provided, they are prioritized as follows: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

The image subject is the core product area in the image.

Example: "[1, 2, 4]"

NonObjectRemoveElements

Number[]

No

An array of element types to remove from the non-subject area (1 = transparent text block, 2 = specific name, 3 = text, 4 = psoriasis-style ads). You can select multiple types. For descriptions of each type, see the Supported elements section.

At least one of the following parameters must be provided: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage. If multiple parameters are provided, they are prioritized as follows: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

Example: "[1, 2, 4]"

Mask

String

No

Specifies the exact removal area. This parameter is typically used with an editor and must be an RLE encoding string.

At least one of the following parameters must be provided: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage.

If multiple parameters are provided, they are prioritized as follows: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

Example: "474556 160 475356 160 476156 160 476956 160 477756 160 478556 160 479356 160 480156 160 480956 160 481756 160 482556 160 483356 160 484156 160 484956 160 485756 160 486556 160 487356 160 488156 160 488956 160 489756 160 490556 160 491356 160 492156 160"

Position

String

No

Specifies the exact removal area using four-point coordinates [x1,y1,x2,y2]. This parameter is typically used with an editor.

At least one of the following parameters must be provided: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage. If multiple parameters are provided, they are prioritized as follows: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

UserText

String[]

No

An array of text strings to remove. Format as ["text1", "text2"].

At least one of the following parameters must be provided: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage. If multiple parameters are provided, they are prioritized as follows: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

UserImage

String[]

No

An array of image URLs specifying elements to remove. Format as ["https://example.com/element1.jpg", "https://example.com/element2.jpg"].

At least one of the following parameters must be provided: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage. If multiple parameters are provided, they are prioritized as follows: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

RLE encoding uses a space-separated string of "start_pixel length" pairs, following the COCO mask convention. The coordinate system originates from the top-left corner of the image.

Response parameters

Parameter

Type

Description

Code

String

The business status code. A value of Success indicates that the request was successful.

RequestId

String

The unique request ID.

Message

String

The message. The value is "Success" if the request is successful.

Success

Boolean

Indicates whether the call was successful.

Data

Object

The returned result object.

Data.ImageUrl

String

The OSS signed URL of the resulting image.

Data.Width

Number

The width of the output image in pixels, same as the original.

Data.Height

Number

The height of the output image in pixels, same as the original.

Data.UsageMap

Object

An object that contains usage information.

Data.UsageMap.ProcessedImageCount

Number

The number of images processed in this call, used for billing.

Example

Request example

{
  "ImageUrl": "https://aib-innovation-oss.oss-accelerate.aliyuncs.com/AI_Business/asTYo/removaltest2.png?Expires=3356502130&OSSAccessKeyId=LTAI*****",
  "NonObjectRemoveElements": null,
  "ObjectRemoveElements": [
    1,
    2,
    4
  ],
  "Mask": null,
  "UserText": [
    "科技",
    "秘密武器"
  ],
  "UserImage": [
    "xxxxxxxxx",
    "xxxxxxxxx"
  ]
}

Response example

{
  "Data": {
    "ImageUrl": "http://dashscope-7c2c.oss-cn-shanghai.aliyuncs.com/7d/25/20260813/909f6051/feb09c19-e7f7-4b64-856d-0c83cac288b0.jpg?Expires=1789198273&OSSAccessKeyId=LTAI*****",
    "Height": 896,
    "UsageMap": {
      "ProcessedImageCount": 1
    },
    "Width": 692
  },
  "RequestId": "019FFA08-2261-19C1-A546-0137FD063D3B",
  "Message": "Success",
  "Code": "success",
  "Success": true
}

Tips

  • Remove non-subject elements only: For main product images, you often need to remove promotional text from the background but keep product labels on the subject. In this scenario, you only need to pass the NonObjectRemoveElements parameter.

  • Handle large text areas on the subject: If a subject has a large text element, such as a brand logo on a T-shirt, direct removal might compromise the subject's integrity. Use smart element recognition first to evaluate the impact before proceeding with removal.

  • Precisely remove a specific area: If automatic detection is not precise enough for an irregularly shaped element, such as a watermark, use the Mask parameter to define the exact removal area.

  • Remove specific images or text: When you know exactly which objects to remove, you can pass their image URLs in the UserImage parameter (supports multiple URLs) or their text content in the UserText parameter (supports multiple strings). The system will automatically locate and remove the corresponding content without requiring a manually defined area.

Error codes

Error code

Description

InvalidParameter

The image format, resolution, or size is out of range. ObjectRemoveElements and NonObjectRemoveElements are both empty and Mask is not specified. Mask is not a valid RLE encoding.

InputContentBlocked

The input image has triggered a content moderation review.

DownstreamUnavailable

Image download failed, or a downstream vision model is temporarily unavailable. We recommend retrying with exponential backoff.

FreeQuotaExhausted

Your trial quota has been used up. You must purchase a resource plan or disable the "Stop When Exhausted" setting.

InternalError

Internal server error. Please save the RequestId and contact technical support.

For a complete list of error codes, see Error Codes.

Limitations

  • Call mode: Synchronous. The default QPS is 5, with a request timeout of 30 seconds.

  • Input image: JPG, JPEG, PNG, BMP, or WEBP; resolution between 256×256 and 3000×3000; file size ≤ 10 MB.

  • Mask mode: When Mask is passed, the parameters for subject and non-subject enumeration and elimination are ignored. The three cannot all be empty.

  • Billing: $0.01/image, billed based on ProcessedImageCount. For more information, see Asset Optimization Billing.

FAQ

If an object is obscured by text, can the service generate the obscured area after removing the text?

Currently, the service only supports removing the selected region and performing simple color-based inpainting. It does not support generating complex object areas.

If the automatic removal result is not ideal, can I adjust it manually?

Yes. By integrating with an editor, you can manually adjust the removal area by painting, box-selecting, or circling regions.

Next steps