Smart Removal

Updated at:

Smart Removal optimizes e-commerce images by automatically detecting and removing elements such as text, specific names, transparent text blocks, and visual clutter. You can specify which objects to remove to process large batches of images efficiently and accurately, simplifying your image editing workflow. This is a synchronous API.

Use cases

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

  • Synchronize product listings across multiple platforms: Quickly remove specific text and visual clutter to meet each platform's image guidelines.

  • Prepare marketing assets: Easily remove old promotional information from images to update them for new campaigns.

  • Layer metadata (editor protocol): After you enable UseImageEditor, the response returns additional layout metadata such as the text position, font, and color. You can use this data for secondary editing. For the full field reference, see Image Translation Editor Protocol.

Merchants and platforms can bulk-remove unwanted elements to improve image quality. For best results, use this service with Intelligent Element Recognition. First, use Intelligent Element Recognition to identify images that contain text, a specific name, a transparent text block, or visual clutter. Then, use the Smart Removal API to remove these elements in batches. For scenarios where you do not need to remove all detected elements, you can provide a list of specific text strings to be removed.

Intelligent Element Recognition focuses on detection, while Smart Removal focuses on removal. Calling these services in sequence maximizes removal effectiveness and reduces the risk of incorrect removals or identifications. If you need to perform both steps in a single, orchestrated workflow, you can use Intelligent Image Generation.

Supported elements for removal

Enum value

Description

Typical example

1

Transparent text block

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

2

Specific name

Brand names, store names, or custom keywords.

3

Text

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

4

Visual clutter

Promotional copy, exaggerated decorative elements, or fake certification badges, including colored text blocks.

The service distinguishes between two types of regions: the image subject (the core product area) and the image non-subject (the background and other areas). The ObjectRemoveElements parameter controls removal on the image subject, and the NonObjectRemoveElements parameter controls removal on the image non-subject. You can configure both parameters independently.

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

How it works

  1. The service differentiates between two main areas of an image, allowing you to apply removal operations to a specific area. You can integrate the service through an API or an editor to meet different requirements.

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

    2. Image non-subject: The rest of the image, excluding the subject.

  2. You can specify elements for removal in three ways:

    1. By element type: Select from predefined types, such as text, specific names, transparent text blocks, or visual clutter. Use the examples to determine the best options for your use case.

    2. By providing a sample image: Specify one or more images of the elements you want to remove.

    3. By providing specific text: Specify one or more text strings to remove.

The processing workflow is as follows: You provide an image URL. The service uses Optical Character Recognition (OCR) and Vision Language Models (VLMs) to locate elements, determines which areas to inpaint, generates a clean image using AI, and returns its URL.

Before-and-after examples

Text

Region

Original image

Resulting image

On the image subject

image

image

On the image non-subject

image

image

Specific name

Region

Original image

Resulting image

On the image subject

image

image

On the image non-subject

image

image

Transparent text block

Region

Original image

Resulting image

On the image subject

image

image

On the image non-subject

image

image

Visual clutter

Region

Original image

Resulting image

On the image subject

image

image

On the image non-subject

image

image

Specified objects

Removal type

Original image

Resulting image

Removing specified image elements (multiple image URLs supported)

image

image

Removing specified text (multiple text strings supported)

image

image

API

POST /rest/ai/image/remove

Quick start

import json

# Removes transparent text blocks, specific names, and visual clutter 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("Resulting image:", d["ImageUrl"])
print("Output dimensions:", d["Width"], "x", d["Height"])

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 256x256 and 3000x3000 pixels, and the file size must not exceed 10 MB.

Example: "https://example.com/product.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=visual clutter). You can select multiple types. This parameter is optional, but 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 about each type, see the Supported elements for removal table.

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 image non-subject (1=transparent text block; 2=specific name; 3=text; 4=visual clutter). You can select multiple types. This parameter is optional, but 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 about each type, see the Supported elements for removal table.

Example: [1, 2, 4]

Mask

String

No

Specifies the removal area. This parameter is typically used with an editor. The input must be in RLE encoding.

This parameter is optional, but 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.

Example: "474556 160 475356 160 476156 160..."

Position

String

No

Specifies the removal area by using four-point coordinates, such as [x1,y1,x2,y2]. This parameter is typically used with an editor. This parameter is optional, but 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.

UserText

String[]

No

Specifies the text to remove. You can provide multiple text strings in an array, such as ["text1", "text2"]. This parameter is optional, but 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.

UserImage

String[]

No

The links to the image elements that you want to remove. You can specify multiple links in the format ["https://ae01.alicdn.com/kf/S342f0070dc9f4be09a6cbed34e90dc8fs.jpg","https://ae01.alicdn.com/kf/S342f0070dc9f4be09a6cbed34e90dc8fs.jpg"]. This parameter is optional, but you must specify at least one of the ObjectRemoveElements, NonObjectRemoveElements, Mask, Position, UserText, or UserImage parameters.

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

RLE encoding is a space-separated string of start-pixel and length pairs, following the COCO mask convention. The coordinate system origin is the top-left corner of the image.

Response fields

Field

Type

Description

Code

String

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

RequestId

String

The unique ID of the request.

Message

String

The returned message. A value of "Success" indicates that the request was successful.

Success

Boolean

Indicates whether the request was successful.

Data

Object

The data structure of the returned result.

Data.ImageUrl

String

The URL of the resulting image after processing. This is a signed OSS URL.

Data.Width

Number

The width of the output image in pixels. Same as the original image.

Data.Height

Number

The height of the output image in pixels. Same as the original image.

Data.UsageMap

Object

The usage information.

Data.UsageMap.ProcessedImageCount

Number

The number of processed images, which is used for billing.

Examples

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": [
    "Technology",
    "Secret Weapon"
  ],
  "UserImage": [
    "https://example.com/element-to-remove-1.png",
    "https://example.com/element-to-remove-2.png"
  ]
}

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
}

Usage notes

  • Remove elements from the non-subject area only: Primary product images often require removing only background promotional text, while keeping labels on the product itself. For this use case, specify only the NonObjectRemoveElements parameter.

  • Handle large text on the subject: For images with large text on the subject, such as a brand logo on a T-shirt, direct removal can damage the subject. Use Intelligent Element Recognition to evaluate the image before attempting removal.

  • Precisely remove a specific area: If automatic detection does not accurately cover the target element, such as an irregularly shaped watermark, you can specify the exact removal area by using the Mask parameter.

  • Remove specific image elements or text: When you know exactly which elements to remove, use the UserImage parameter to pass their URLs (multiple supported) or the UserText parameter to pass the text strings (multiple supported). The system automatically locates and removes the specified content, so you do not need to manually define a removal area.

Error codes

Error code

Cause

InvalidParameter

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

InputContentBlocked

The input image failed the content moderation review.

DownstreamUnavailable

The service failed to download the image, or a downstream vision model is temporarily unavailable. Retry the request using an exponential backoff strategy.

FreeQuotaExhausted

Your free trial quota has been used up. You need to purchase a resource plan or disable the 'Stop After Expiration' setting.

InternalError

Server-side internal error. Please save the RequestId and contact technical support.

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

Limitations

  • Invocation mode: Synchronous. The default queries per second (QPS) is 5, and the maximum request timeout is 30 seconds.

  • Input image: Supported formats are JPG, JPEG, PNG, BMP, and WEBP. The resolution must be between 256×256 and 3000×3000 pixels. The file size must not exceed 10 MB.

  • Mask mode: When Mask is passed, the subject/non-subject enumeration removal parameters are ignored. Not all three can be empty.

  • Billing: ¥0.025 per image, based on the ProcessedImageCount value. For more information, see Asset Optimization Billing.

FAQ

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

Currently, the service only removes the element and performs simple color inpainting. It cannot regenerate complex object areas.

If the automatic removal results are not satisfactory, can I make manual adjustments?

Yes. To make manual adjustments, integrate with an editor to paint, box-select, or lasso removal areas. Aidge will provide this editor capability in the console in a future release.

Next steps