Smart erase (Asynchronous)

Updated at:

Overview

Smart Erase is a feature designed for e-commerce images. It automatically detects and removes text, specific names, transparent text blocks, and unwanted marks. You can also specify which objects to remove, enabling efficient and precise batch processing that simplifies your workflow.

Use cases

  • Efficient e-commerce image processing:

Remove distracting visual elements to create clearer, more focused product displays and enhance the customer shopping experience.

  • Cross-platform product information synchronization:

When listing products across different e-commerce platforms, you can quickly remove specific text and unwanted marks to comply with the image standards of each platform.

  • Marketing material preparation:

Easily remove old promotional information and update images with new campaign details.

Note: Businesses and platforms can batch-remove unwanted elements to optimize image quality. We recommend using this feature in combination with the Smart Recognition API (coming soon). First, use the Smart Recognition API to filter for images that contain text, specific names, transparent text blocks, or unwanted marks. Then, call the Smart Erase API to remove them in batches. The Smart Recognition API focuses on "recognition," while the Smart Erase API focuses on "removal." By calling them in sequence, you can improve accuracy and reduce errors.

How it works

  1. First, understand the definitions of image subject and image background. When specifying objects to remove, you can choose whether the removal applies to the image subject or the image background. The service can be integrated via an API or used through an editor.

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

    2. Image background: The rest of the image outside the image subject.

  2. Second, you can specify what to remove in three ways:

    1. By type: Select categories of elements to remove, such as text, specific names, transparent text blocks, and unwanted marks. Refer to the examples to determine the appropriate operation for your needs.

    2. (New) By specific image: Specify one or more image elements to remove by providing their URLs.

    3. (New) By specific text: Specify one or more text strings to remove.

Processing workflow: A user provides an original image URL → An Optical Character Recognition (OCR) and VLM model detects the location of text or image elements → The system determines the coordinates of the area to be inpainted → AI inpainting generates a clean image → The system returns the URL of the resulting image.

Before and after examples

Removable object type

Original image

Resulting image

Text

  • On the image subject

image.png

  • On the image background

image.png

  • On the image subject

image.png

  • On the image background

image.png

Specific names

  • On the image subject

image.png

  • On the image background

image.png

  • On the image subject

image.png

  • On the image background

image.png

Transparent text blocks

  • On the image subject

image.png

  • On the image background

image.png

  • On the image subject

image.jpeg

  • On the image background

image.jpeg

Unwanted marks

  • On the image subject

image.jpeg

  • On the image background

image.png

  • On the image subject

image.jpeg

  • On the image background

image.jpeg

Remove specified image elements (supports multiple image URLs)

image.png

image.png

Remove specified text (supports multiple text strings)

image.png

image.png

Developer guide

Request parameters

Parameter

Type

Required

Description

ImageUrl

String

Yes

The URL of the original image. The image must be in JPG, JPEG, PNG, BMP, or WEBP format. The resolution must be between 256×256 and 3000x3000 pixels, and the file size must not exceed 10 MB.

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

ObjectRemoveElements

Number[]

No

The elements to remove from the image subject. You can select multiple element types. Valid values are: 1 (transparent text blocks), 2 (specific names), 3 (text), and 4 (unwanted marks). This parameter is optional; however, you must specify at least one of the following parameters: ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage.

If multiple parameters are specified, the order of precedence is: UserImage > UserText > Position > Mask > ObjectRemoveElements = NonObjectRemoveElements.

For details on element types, see the product description.

Image subject: The core product area in the image.

Example: "[1, 2, 4]"

NonObjectRemoveElements

Number[]

No

The elements to remove from the image background. You can select multiple element types. Valid values are: 1 (transparent text blocks), 2 (specific names), 3 (text), and 4 (unwanted marks). This parameter is optional.

For details on parameter precedence and requirements, see the description of ObjectRemoveElements.

For details on element types, see the product description.

Example: "[1, 2, 4]"

Mask

String

No

The specific area to remove, specified in Run-Length Encoding (RLE) format. This parameter is typically used with an editor.

If specified, this parameter takes precedence over ObjectRemoveElements and NonObjectRemoveElements.

This parameter is optional.

For details on parameter precedence and requirements, see the description of ObjectRemoveElements.

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

The specific area to remove, specified as four-point coordinates, for example, [x1,y1,x2,y2]. This parameter is typically used with an editor. This parameter is optional.

For details on parameter precedence and requirements, see the description of ObjectRemoveElements.

UserText

String[]

No

The text strings to remove. You can specify multiple strings in the format ["text1","text2"]. This parameter is optional.

For details on parameter precedence and requirements, see the description of ObjectRemoveElements.

UserImage

String[]

No

The URLs of image elements to find and remove. You can specify multiple image URLs in the format ["https://ae01.alicdn.com/kf/S342f0070dc9f4be09a6cbed34e90dc8fs.jpg","https://ae01.alicdn.com/kf/S342f0070dc9f4be09a6cbed34e90dc8fs.jpg"]. This parameter is optional.

For details on parameter precedence and requirements, see the description of ObjectRemoveElements.

Request example

{
  "ImageUrl": "https://aib-innovation-oss.oss-accelerate.aliyuncs.com/AI_Business/asTYo/removaltest2.png?Expires=3356502130&OSSAccessKeyId=LTAI5tE8X3gEy66SRU1V8dig&Signature=QI%2BNEcHO%2FNCMgNnx5lv%2B0JxQ7KE%3D",
  "NonObjectRemoveElements": null,
  "ObjectRemoveElements": [
    1,
    2,
    4
  ],
  "Mask": null,
  "UserText": [
    "Technology",
    "Secret Weapon"
  ],
  "UserImage": [
    "xxxxxxxxx",
    "xxxxxxxxx"
  ]
}

Response parameters

Parameter

Type

Description

Code

String

The status code, such as "success".

Success

Boolean

true if the request was successful; false otherwise.

Message

String

An error message if the request fails, such as "The parameter contains sensitive information, please try other input."

RequestId

String

The unique request ID.

Data

Object

The object containing the result data.

Data.ImageUrl

String

The URL of the processed image.

Data.Width

Number

The width of the output image in pixels.

Data.Height

Number

The height of the output image in pixels.

Data.UsageMap

Object

An object containing usage data.

Data.UsageMap.ProcessedImageCount

Number

The number of images processed.

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=LTAI5tPxpiCM2hjmWrFXrym1&Signature=bXySUcguJBqgnVBnmtKHBTK4EhM%3D",
    "Height": 896,
    "UsageMap": {
      "ProcessedImageCount": 1
    },
    "Width": 692
  },
  "RequestId": "019FFA08-2261-19C1-A546-0137FD063D3B",
  "Message": "Success",
  "Code": "success",
  "Success": true
}

Integration and invocation

Before you begin

Smart Erase supports both synchronous and asynchronous invocation modes. This document describes the asynchronous API. For the synchronous version, see Smart Erase.

This asynchronous API uses the same result retrieval process, RocketMQ subscription rules, message encryption protocol, dependency configurations, and Java consumer and decryption code as other asynchronous APIs.

For details on the integration process, subscription rules, message format, encryption protocol, and implementation for asynchronous calls, see Asynchronous API Call Instructions.

Billing

¥0.025 per image

Limitations

  • Invocation mode: Asynchronous. Default QPS = 5. The submission request timeout is 30 seconds.

  • Input image: Must be in JPG, JPEG, PNG, BMP, or WEBP format. The resolution must be between 256×256 and 3000×3000 pixels. The file size must be 10 MB or less.

  • Billing: Billed per item based on ProcessedImageCount.

FAQ

  1. If an object is obscured by text, can the service regenerate the obscured area after removing the text?

The service removes the specified content and performs basic color restoration, but it does not regenerate complex object details.

  1. If the automatic removal result from the Smart Erase API is not satisfactory, is there a way to make manual adjustments?

Yes. If you integrate via the editor, you can make manual adjustments. In the editor, you can paint, box-select, or lasso the selection to remove. An editor console will be available later through Aidge to support these features.