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 |
| transparent text block | Monochromatic transparent text or semi-transparent color blocks, typically used as watermarks. |
| specific name | Brand names, store names, and custom keywords. |
| text | Horizontal, vertical, or slanted text in Chinese and English. |
| 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
The service distinguishes between the image subject and the non-subject area. You can target elements for removal in either region.
Image subject: The core product area in the image.
Non-subject area: The rest of the image, excluding the subject.
You can remove elements in one of three ways:
Select element types for removal, such as text, specific names, transparent text blocks, and psoriasis-style ads.
Provide images of the elements to remove. You can specify multiple images.
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 |
|
|
Does not overlap with the image subject |
|
|
Specific name
Area | Source image | Output image |
Overlaps with the image subject |
|
|
Does not overlap with the image subject |
|
|
Transparent text block
Area | Source image | Output image |
Overlaps with the image subject |
|
|
Does not overlap with the image subject |
|
|
Psoriasis-style ads
Area | Source image | Output image |
Overlaps with the image subject |
|
|
Does not overlap with the image subject |
|
|
Specified objects
Type | Source image | Output image |
Remove specified image elements (supports multiple image URLs) |
|
|
Remove specified text (supports multiple text strings) |
|
|
API
POST /rest/ai/image/removeQuick 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: |
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: The image subject is the core product area in the image. Example: |
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: Example: |
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: If multiple parameters are provided, they are prioritized as follows: Example: |
Position | String | No | Specifies the exact removal area using four-point coordinates At least one of the following parameters must be provided: |
UserText | String[] | No | An array of text strings to remove. Format as At least one of the following parameters must be provided: |
UserImage | String[] | No | An array of image URLs specifying elements to remove. Format as At least one of the following parameters must be provided: |
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 |
| String | The business status code. A value of |
| String | The unique request ID. |
| String | The message. The value is |
| Boolean | Indicates whether the call was successful. |
| Object | The returned result object. |
| String | The OSS signed URL of the resulting image. |
| Number | The width of the output image in pixels, same as the original. |
| Number | The height of the output image in pixels, same as the original. |
| Object | An object that contains usage information. |
| 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
NonObjectRemoveElementsparameter.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
Maskparameter 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
UserImageparameter (supports multiple URLs) or their text content in theUserTextparameter (supports multiple strings). The system will automatically locate and remove the corresponding content without requiring a manually defined area.
Error codes
Error code | Description |
| The image format, resolution, or size is out of range. |
| The input image has triggered a content moderation review. |
| Image download failed, or a downstream vision model is temporarily unavailable. We recommend retrying with exponential backoff. |
| Your trial quota has been used up. You must purchase a resource plan or disable the "Stop When Exhausted" setting. |
| Internal server error. Please save the |
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
Maskis 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
Next steps
smart element recognition -- Use this as the first step in a "recognize, then remove" workflow with this API.
smart matting -- Extract the main subject after removing unwanted elements.



















