Image Background Removal

Introduction

The Image Background Removal automatically identifies the main object in an image, separates it from the background, and returns the image of main object with white or transparent backgrounds. It provides a variety of background options and custom size selections to optimize product display.

Use Cases

  • Further editing: After separating the main object from the background, users can further edit the image.

  • Image editing efficiency improvement: Quickly extract the main object from various images, thereby enhancing the efficiency of creating high-quality advertising visuals and marketing posters.

Samples

Input image (input)Result image (output)

Key Features

  • Suitable for background removal of various product categories, especially for images with clear and distinct subjects.

  • It supports various image background forms generation, including white background and transparent background, suitable for different scenarios.

  • It supports generating images with specified target size, and it can return the subject image with automatically removed edge blank areas and scaled to the desired size.

Pricing

To use the API, you are required to choose and purchase an API resource pack from us on a subscription basis.

  • Each resource pack is valid for one calendar year upon successful purchase, and enables you to access the API up to the number of requests specified in the pack. No refunds can be provided.

  • If you need to purchase more QPS due to business requirements, please contact us via navigation bar or email us (aidge_support@service.alibaba.com).

  • Resource packs cannot be used across different products. For example, if you need to use both product text translation and image translation, you must purchase separate resource packs for each.

CapacityPrice (USD)Unit Price(USD)Maximum QPS

1,000 images

32

$0.032 /image

10

10,000 images

320

$0.032 /image

10

100,000 images

3200

$0.032 /image

10

Quick Start

1. Sample Request

  • Input limitations:

  • Image format: JPEG、JPG、PNG、BMP、WEBP

  • Image size: no more than 4 MB

  • Image resolution: The size of input image should be more than 512×512 pixels and less than 3000×3000 pixels.

IopClient client = new IopClient(url, appkey, appSecret);
IopRequest request = new IopRequest();
request.setApiName("/ai/image/cut/out");
request.addApiParameter("backGroundType", "WHITE_BACKGROUND");
request.addApiParameter("imageBase64", "");
request.addApiParameter("targetHeight", "1000");
request.addApiParameter("imageUrl", "https://ae01.alicdn.com/kf/Sa78257f1d9a34dad8ee494178db12ec8l.jpg");
request.addApiParameter("targetWidth", "800");
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);

2. Sample Response

{
  "data": {
    "score": 0.8799999952316284,
    "imageUrl": "http://nhci-image.oss-ap-southeast-1.aliyuncs.com/data%2Fgeneral_matting_online%2FAIDC_AIB_SERVICE%2F7089bce4c9d1469cb552dd225e28a254_202406261430_0.8799999952316284.jpg?OSSAccessKeyId=LTAI5t7WDuqmGKhsCAdMMfuH&Expires=2719383457&Signature=3z8ybSgwj5Tns3LahE%2FJXPh99Tg%3D",
    "usage": 1,
    "width": 800,
    "class": "com.aidc.service.api.client.image.dto.ImageGenResponse",
    "height": 1000
  },
  "requestId": "2101364217193834573077250e647d",
  "success": true,
  "resCode": 200,
  "resMessage": "success",
  "code": "0",
  "request_id": "21015e2217193834573111639",
  "_trace_id_": "2101364217193834573077250e647d"
}

FAQ

  1. Which type of images is the API not applicable?

The Image Background Removal API performs well on e-commerce product images where the main object occupies a large portion of the image, is complete, and is either a single or multiple clearly defined objects. However, for images with transparent or other special materials, or images with unclear subjects, there may be some degree of processing deviations and errors. This includes images such as product usage steps, close-up detail shots, and SKU collages.

  1. After background removal, will the resolution and quality of image get worse?

No. When the target width and height are not set in the input parameters, the result will return in the original image size, and the quality of the subject will not be affected. However, if the target width and height are set and they differ from the input image size, the result will be returned in the specified target size, and the subject may be scaled accordingly. If the difference between the target size and the original size is too large, the quality might be affected.

Last updated