Intelligent matting (asynchronous)
1. Introduction
The intelligent matting service automatically identifies the prominent subject in an image, separates the subject from the background, and returns an image of the subject with the background removed. The service also provides multiple background options and custom dimension settings to enhance product displays.
2. Use cases
Prepare materials for further editing: After separating the subject from the background, you can make additional edits to the image.
Improve material processing efficiency: Quickly extract subjects from various images to simplify background replacement, which speeds up the creation of ad visuals and marketing posters.
3. Features
1. One-click accurate subject detection
AI-powered automatic recognition: Based on a deep learning model, the service intelligently distinguishes the foreground subject (such as a person, product, or object) from the background, eliminating the need for manual outlining.
Adapts to complex scenarios: Delivers precise segmentation for complex details like hair strands, transparent objects, and furry edges, with an accuracy rate of over 95%.
2. Intelligent edge optimization
Fine-detail processing: Automatically smooths jagged edges and refines semi-transparent areas (such as smoke or glass) for a natural transition.
3. Flexible output and background controls
Export with different backgrounds: Directly generate transparent PNGs and white-background images suitable for e-commerce, design, and other scenarios.
Supports custom background colors
4. Sample comparison
Input | Output |
|
|
|
|
|
|
5. API reference
5.1 Request parameters
Parameter | Type | Required | Description |
BackGroundType | String | Yes | Specifies the background for the output image. Valid values: -WHITE_BACKGROUND: A white-background image. -TRANSPARENT: A transparent image. Example: |
ImageUrl | String | Yes | The URL of the source image. The image must be in JPG, JPEG, PNG, BMP, or WEBP format. The resolution must be between 100×100 and 3000x3000 pixels. The file size cannot exceed 10 MB. Example: |
TargetWidth | Integer | No | The desired width of the output image. If you do not specify this parameter, the original image width is used. Unit: pixel. Valid values: 100–5000. Example: |
TargetHeight | Integer | No | The desired height of the output image. If you do not specify this parameter, the original image height is used. Unit: pixel. Valid values: 100–5000. Example: |
BgColor | String | No | The background color in BGR (Blue, Green, Red) format. The default value is white. Example: |
5.2 Request example
{
"TargetHeight": 800,
"BgColor": "255,255,255",
"ImageUrl": "https://aib-innovation-oss.oss-accelerate.aliyuncs.com/AI_Business/CTqd9/ImageMatting-1?Expires=3356508287&OSSAccessKeyId=LTAI5tE8X3gEy66SRU1V8dig&Signature=LT5UtAp%2B1Rch7Eu2UqTj5kvurww%3D",
"BackGroundType": "WHITE_BACKGROUND",
"TargetWidth": 800
}5.3 Response parameters
Parameter | Type | Description |
Code | String | The status code, for example, "success". |
Success | Boolean | Indicates whether the request was successful. |
RequestId | String | The request ID that uniquely identifies this call. |
Data | Object | The object that contains the results. |
Data.ImageUrl | String | The URL of the processed image. |
Data.Score | Number | The image quality score. |
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 | The usage details. |
Data.UsageMap.ProcessedImageCount | Number | The number of processed images. |
5.4 Response example
{
"Data": {
"ImageUrl": "http://dashscope-7c2c.oss-cn-shanghai.aliyuncs.com/7d/4a/20260525/f3547444/52033655bd054737960a87518655d935_202605251926_5.959999978542328.jpg?Expires=1782300370&OSSAccessKeyId=LTAI5tPxpiCM2hjmWrFXrym1&Signature=XskJ9GEdikVhbBz7DfgbESj5xJ0%3D",
"Score": 5.959999978542328,
"Height": 800,
"UsageMap": {
"ProcessedImageCount": 1
},
"Width": 800
},
"RequestId": "7BEDF90E-D04E-1430-BDAE-18A31F84A348",
"Message": "Success",
"Code": "success",
"Success": true
}5.5 Error codes
For more information, see Error codes.
6. Prerequisites and call process
6.1 Before you begin
The intelligent matting service supports both synchronous and asynchronous call modes. This document describes the asynchronous API. For synchronous calls, see Intelligent matting.
The asynchronous APIs for intelligent matting and other features share the same process for retrieving results, RocketMQ subscription rules, message encryption protocols, and Java code for consuming and decrypting messages.
For the asynchronous integration process, subscription rules, message formats, encryption protocols, and detailed integration solutions, see Asynchronous API call instructions.
7. Billing
CNY 0.002 per image.
8. Limitations
Call mode: Default QPS is 5. Maximum request timeout is 30 seconds.
Input image: JPG, JPEG, PNG, BMP, or WEBP. The resolution must be between 100×100 and 3000x3000 pixels. The file size cannot exceed 10 MB.
Billing: You are charged based on the
ProcessedImageCount. For more information, see Material Optimization Billing.
9. FAQ
How does the performance of intelligent matting vary across different image types?
The intelligent matting service performs best on e-commerce product hero images where the subject is large, complete, and clearly defined as a single subject or multiple distinct subjects. For images with products made of special materials like transparent objects, or images with ambiguous subjects, the matting process may produce inaccurate results. Examples include product instruction diagrams, close-up detail shots, and SKU composite images.
Does the matting process reduce the resolution or quality of the subject?
No. If you do not specify target dimensions in the request parameters, the output image retains the original dimensions, and the subject's quality is unaffected. However, if you set the target width and height to values different from the original image dimensions, the output will be resized accordingly, which involves scaling the subject. If the target dimensions are significantly different from the original, the quality may be affected.





