tencent cloud

Cloud Object Storage

最新情報とお知らせ
製品アップデート情報
製品のお知らせ
製品概要
製品概要
機能概要
応用シナリオ
製品の優位性
基本概念
リージョンとアクセスドメイン名
仕様と制限
製品の課金
課金概要
課金方式
課金項目
無料利用枠
記帳例
請求書の確認とダウンロード
お支払い遅れについて
よくある質問
クイックスタート
コンソールクイックスタート
COSBrowserクイックスタート
ユーザーガイド
リクエストの作成
バケット
オブジェクト
データ管理
バッチ処理
グローバルアクセラレーション
監視とアラーム
運用管理センター
データ処理
インテリジェントツールボックス使用ガイド
データワークフロー
アプリ統合
ツールガイド
ツール概要
環境のインストールと設定
COSBrowserツール
COSCLIツール
COSCMDツール
COS Migrationツール
FTP Serverツール
Hadoopツール
COSDistCpツール
HDFS TO COSツール
オンラインツール (Onrain Tsūru)
セルフ診断ツール
実践チュートリアル
概要
アクセス制御と権限管理
パフォーマンスの最適化
AWS S3 SDKを使用したCOSアクセス
データディザスタリカバリバックアップ
ドメイン名管理の実践
画像処理の実践
COSオーディオビデオプレーヤーの実践
データセキュリティ
データ検証
COSコスト最適化ソリューション
サードパーティアプリケーションでのCOSの使用
移行ガイド
サードパーティクラウドストレージのデータをCOSへ移行
データレークストレージ
クラウドネイティブデータレイク
メタデータアクセラレーション
データアクセラレーター GooseFS
データ処理
データ処理概要
画像処理
メディア処理
コンテンツ審査
ファイル処理
ドキュメントプレビュー
トラブルシューティング
RequestId取得の操作ガイド
パブリックネットワーク経由でのCOSへのファイルアップロード速度の遅さ
COSへのアクセス時に403エラーコードが返される
リソースアクセス異常
POST Objectの一般的な異常
セキュリティとコンプライアンス
データ災害復帰
データセキュリティ
クラウドアクセスマネジメント
よくある質問
よくあるご質問
一般的な問題
従量課金に関するご質問
ドメインコンプライアンスに関するご質問
バケット設定に関する質問
ドメイン名とCDNに関するご質問
ファイル操作に関するご質問
権限管理に関するご質問
データ処理に関するご質問
データセキュリティに関するご質問
署名付きURLに関するご質問
SDKクラスに関するご質問
ツール類に関するご質問
APIクラスに関するご質問
Agreements
Service Level Agreement
プライバシーポリシー
データ処理とセキュリティ契約
連絡先
用語集
ドキュメントCloud Object Storage

Image Matting

フォーカスモード
フォントサイズ
最終更新日: 2026-01-09 22:33:18

Feature Description

Tencent Cloud DataVinci detects product information in images through the GoodsMatting interface, generates images containing only product information, and supports processing upon upload, cloud data processing, and processing during download.
Note:
This API belongs to a GET request. It is a synchronous request method and requires carrying a signature. For specific signature settings, please see Request Signature.

Authorization Description

When used by a sub-account, corresponding permissions must be granted. For COS permissions, please refer to COS action. For CI permissions, please refer to CI action.
Processing during download: Set action to authorization policy to cos:GetObject, ci:CreateGoodsMattingJob.
Process upon upload: Set action to authorization policy to cos:PutObject.
Cloud data processing: In the authorization policy, set the action to cos:GetObject and cos:PutObject (Note: The resource corresponding to GetObject is the source file, and the resource corresponding to PutObject is the transferred file).

Service Activation

Using this feature requires enabling Cloud Infinite in advance and binding a bucket. For details, see Binding a bucket.
Use this feature requires enabling AI Content Recognition service in advance via console or API. For details, see Enabling AI Content Recognition service.

Use Limits

When using this API, please first confirm the relevant restrictions. For details, see Usage Limits.

Fee Description

This API is a paid service. The generated costs will be charged by CI. For detailed billing instructions, please refer to CR fees.

Method One: Processing during Download



Request

 Original image stored in COS.
GET /<ObjectKey>?ci-process=GoodsMatting HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
 Original image from another link.
GET /?ci-process=GoodsMatting&detect-url=<detect-url> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>

Processing Parameter Description

Operation name: GoodsMatting.
Parameter
Meaning
Type
Required or Not
ObjectKey
object filename, for example: folder/document.jpg
String
No
ci-process
Cloud Infinite processing capability, image matting fixed as GoodsMatting
String
Yes
detect-url
You can process any publicly accessible image link by filling in detect-url. If detect-url is not specified, the backend will default to processing ObjectKey. If detect-url is filled in, the backend will process the detect-url link, and there is no need to fill in ObjectKey.
http://www.example.com/abc.jpg needs to be url encoded, and the processed result is http%25253A%25252F%25252Fwww.example.com%25252Fabc.jpg
String
No
center-layout
Center display for cutout products; centered display when the value is 1, no processing when the value is 0, default is 0
Integer
No
padding-layout
Add padding to all four sides of the processed image in the format padding-layout=<dx>x<dy>, where dx pixels of padding are added to the left and right sides, and dy pixels of padding are added to the top and bottom sides. For example: padding-layout=20x10.
Default does not perform blanking operation, maximum value of dx and dy is 1000 pixels
String
No

Response

HTTP/1.1 200 OK
Content-Type: image/png
Content-Length: 98645
Date: Tue, 23 Apr 2022 09:06:16 GMT
Server: tencent-ci
Status: 200 OK
x-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****

[pic-content]
The processed image is returned directly in the response body.

Method Two: Processing Upon Upload

Request Syntax

PUT /<ObjectKey> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Pic-Operations: <PicOperations>
Note:
Authorization: Auth String. For details, see the Request Signature document.

Request

Request header.

This API only uses common request headers. For details, please refer to the Common Request Headers document.
In addition to common headers, the following headers are required.
Header Name
Description
Type
Pic-Operations
Parameters for image operations
String
Pic-Operations is a json format string. The specific parameters are as follows:
Parameter Name
Type
Required or Not
Description
is_pic_info
Int
No
Whether to return original image information, 0 for no return, 1 for return, default is 0
rules
Array
No
Processing rules, one rule corresponds to one processing result (currently supports five rules), leave blank to skip image processing
Each item in the rules (json array) has the following specific parameters:
Parameter Name
Type
Required or Not
Description
bucket
String
No
Destination bucket name for storing results, format is BucketName-AppId. If not specified, it defaults to the current bucket.
fileid
String
Yes
Storage path and name of the processed file. Naming rules description.
For example, the source file path and name are: /p1/test1.jpg
Absolute path starts with /, for example when the fileid value is /p2/test2.jpg, it means a file named test2.jpg is stored in the p2 folder
Relative path does not start with /, for example when the fileid value is p2/test2.jpg, it means a p2 folder is created in the p1 folder, and then a file named test2.jpg is stored in the p2 folder
Do not end with /, otherwise an empty filename will occur
If you want the repaired image to overwrite the original image, set the fileid field to <ObjectKey>
rule
String
Yes
Fixed as: ci-process=GoodsMatting, simultaneously support center-layout and padding-layout parameters (see download processing parameter description), parameters are connected with &, for example: ci-process=GoodsMatting&center-layout=1&padding-layout=20x10

Request body.

The request body contains the original image to be cropped.
[Image Content]

Response

Response Headers

This API returns common response headers. For details, see the Common Response Headers document.

Response Body

The response body returns content-type as application/xml. The specific data content is as follows:
Node Name (Keyword)
Parent Node
Description
Type
UploadResult
None.
Request result.
Container
The content of UploadResult
Node Name (Keyword)
Parent Node
Description
Type
OriginalInfo
UploadResult
Image information
Container
ProcessResults
UploadResult
Request processing result
Container
The content of the OriginalInfo node
Node Name
Parent Node
Description
Type
Key
OriginalInfo
Original image filename
String
Location
OriginalInfo
path to the image
String
Etag
OriginalInfo
ETag value of the original image
String
Content within the ProcessResults node
Node Name (Keyword)
Parent Node
Description
Type
Object
ProcessResults
Processing result of each image
Container
Content within the Object node
Node Name (Keyword)
Parent Node
Description
Type
Key
Object
Image file name after image matting
String
Location
Object
Image link after image matting
String
ETag
Object
ETag value of the image after image matting
String
Size
Object
Image size after image matting
Int

Examples

Request

PUT /<ObjectKey> HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Pic-Operations:
{
"is_pic_info": 1,
"rules": [{
"fileid": "exampleobject",
"rule": "ci-process=GoodsMatting"
}]
}
Processed images are stored in the bucket, with the value of the field fileid used as the object name.

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 645
Date: Tue, 23 Apr 2022 09:06:16 GMT
Status: 200 OK
Server: tencent-ci
x-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****

<UploadResult>
<OriginalInfo>
<Key>goods_matting.jpg</Key>
<Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/filename.jpg</Location>
<ETag>"ed60e3598e6862d8c8443a06acfb2153"</ETag>
</OriginalInfo>
<ProcessResults>
<Object>
<Key>goods_matting_process.jpeg</Key>
<Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location>
<Format/>
<Size>354256</Size>
<ETag>"521451f63c331becf533e466732c1091"</ETag>
</Object>
</ProcessResults>
</UploadResult>

Method Three: Cloud Data Processing

Request Syntax

POST /<ObjectKey>?image_process HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Authorization: Auth String
Pic-Operations: <PicOperations>
Note:
Authorization: Auth String. For details, see Request Signature document.

Request

Request header

This API only uses common request headers. For details, please refer to the Common Request Headers document.
In addition to common headers, the following headers are required.
Header Name
Description
Type
Pic-Operations
Parameters for image operations
String
Pic-Operations is a json format string. The specific parameters are as follows:
Parameter Name
Type
Required or Not
Description
is_pic_info
Int
No
Whether to return original image information, 0 for no return, 1 for return, default is 0
rules
Array
No
Processing rules. One rule corresponds to one processing result (currently supports five rules). If left blank, no image processing will be performed.
Each item in the rules (json array) has the following specific parameters:
Parameter Name
Type
Required or Not
Description
bucket
String
No
Destination bucket name for storing results, format is BucketName-AppId. If not specified, it defaults to the current bucket.
fileid
String
Yes
Storage path and name of the processed file. Naming rules description.
For example, the source file path and name are: /p1/test1.jpg
Absolute path starts with /, for example when the fileid value is /p2/test2.jpg, it means a file named test2.jpg is stored in the p2 folder
Relative path does not start with /, for example when the fileid value is p2/test2.jpg, it means a p2 folder is created in the p1 folder, and then a file named test2.jpg is stored in the p2 folder
Do not end with /, otherwise an empty filename will occur
If you want the repaired image to replace the original image, set the fileid field to <ObjectKey>
rule
String
Yes
Fixed as: ci-process=GoodsMatting, simultaneously supports center-layout and padding-layout parameters (see download processing parameter description for details), parameters are connected with &, e.g.: ci-process=GoodsMatting&center-layout=1&padding-layout=20x10

Request body

The request body contains the original image to be cropped.
[Image Content]

Response

Response Headers

This API returns common response headers. For details, see the Common Response Headers document.

Response Body

The response body returns content-type as application/xml. The specific data content is as follows:
Node Name (Keyword)
Parent Node
Description
Type
UploadResult
None.
Request result.
Container
The content of UploadResult
Node Name (Keyword)
Parent Node
Description
Type
OriginalInfo
UploadResult
Image information
Container
ProcessResults
UploadResult
Request processing result
Container
The content of the OriginalInfo node
Node Name
Parent Node
Description
Type
Key
OriginalInfo
Original image filename
String
Location
OriginalInfo
Path to the original image
String
Etag
OriginalInfo
ETag value of the original image
String
Content within the ProcessResults node
Node Name (Keyword)
Parent Node
Description
Type
Object
ProcessResults
Processing result of each image
Container
Content within the Object node
Node Name (Keyword)
Parent Node
Description
Type
Key
Object
Image file name after image matting
String
Location
Object
Image link after image matting
String
ETag
Object
ETag value of the image after image matting
String
Size
Object
Image size after image matting
Int

Examples

Request

POST /<ObjectKey>?image_process HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Date: GMT Date
Content-length: Size
Authorization: Auth String
Pic-Operations:
{
"rules": [{
"fileid": "exampleobject",
"rule": "ci-process=GoodsMatting"
}]
}
Processed images are stored in the bucket, with the value of the field fileid used as the object name.

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 645
Date: Tue, 23 Apr 2022 09:06:16 GMT
Status: 200 OK
Server: tencent-ci
x-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****

<UploadResult>
<OriginalInfo>
<Key>goods_matting.jpg</Key>
<Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/filename.jpg</Location>
<ETag>"ed60e3598e6862d8c8443a06acfb2153"</ETag>
</OriginalInfo>
<ProcessResults>
<Object>
<Key>goods_matting_process.jpeg</Key>
<Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location>
<Format/>
<Size>354256</Size>
<ETag>"521451f63c331becf533e466732c1091"</ETag>
</Object>
</ProcessResults>
</UploadResult>


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック