Method | Category | Description |
Processing during download | Synchronous processing | Add the AI processing parameter after the image's URL. |
Processing upon upload | Persistent processing | When uploading images, add the Pic-Operations field in the request header and set the appropriate AI processing parameters. |
Processing in the cloud | Persistent processing | Process existing images on COS using the same processing method as processing upon upload, and add the Pic-Operations field in the request header with the appropriate AI processing parameters set. |
GET /<ObjectKey>?<AI processing parameter> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>
GET /<ObjectKey>?ci-process=AISuperResolution HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>
HTTP/1.1 200 OKContent-Type: image/pngContent-Length: 98645Date: Tue, 23 Apr 2022 09:06:16 GMTStatus: 200 OKx-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****[pic-content]
PUT /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations: <PicOperations>
Header Name | Description | Type |
Pic-Operations | Parameters for image operations | String |
Parameter | Type | Required | Description |
is_pic_info | Int | No | Whether to return original image information. 0 means no return, 1 means return. Default is 0. |
rules | Array | No | Processing rule. One rule corresponds to one processing result (currently supports up to five rules). Leave blank to skip image processing. |
Parameter | Type | Required | Description |
bucket | String | No | The name of the destination bucket for storing results, formatted as BucketName-AppId. If not specified, it defaults to the current bucket. |
fileid | String | Yes | Storage path and name of the processed file. Name rule description: For example, the path and name of the source file are: /p1/test1.jpg. 1. Paths starting with / are absolute paths. For example, when the fileid value is /p2/test2.jpg, it means a file named test2.jpg is stored in the p2 folder. 2. Paths not starting with / are relative paths. For example, when the fileid value is p2/test2.jpg, it means a new p2 folder is created in the p1 folder, and then a file named test2.jpg is stored in the p2 folder. 3. Do not end with /, otherwise an empty filename will occur. 4. If you want the repaired image to overwrite the original image, set the fileid field to <ObjectKey>. |
rule | String | Yes | Processing parameter, example: ci-process=AIImageColoring. |
PUT /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations:{"is_pic_info": 1,"rules": [{"fileid": "exampleobject","rule": "ci-process=AIImageColoring"}]}
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 645Date: Tue, 23 Apr 2022 09:06:16 GMTStatus: 200 OKServer: tencent-cix-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****<UploadResult><OriginalInfo><Key>ObjectKey</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/filename.jpg</Location><ETag>"ed60e3598e6862d8c8443a06acfb2153"</ETag></OriginalInfo><ProcessResults><Object><Key>exampleobject</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location><Format/><Size>354256</Size><ETag>"521451f63c331becf533e466732c1091"</ETag></Object></ProcessResults></UploadResult>
POST /<ObjectKey>?image_process HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations: <PicOperations>
Header Name | Description | Type |
Pic-Operations | Parameters for image operations | String |
Parameter | Type | Required | Description |
is_pic_info | Int | No | Whether to return original image information. 0 means no return, 1 means return. Default is 0. |
rules | Array | No | Processing rule. One rule corresponds to one processing result (currently supports five rules). Leave blank to skip image processing. |
Parameter Name | Type | Required | Description |
bucket | String | No | The name of the destination bucket for storing results, formatted as BucketName-AppId. If not specified, it defaults to the current bucket. |
fileid | String | Yes | Storage path and name of the processed file. Name rule description: For example, the path and name of the source file are: /p1/test1.jpg. 1. Paths starting with / are absolute paths. For example, when the fileid value is /p2/test2.jpg, it means a file named test2.jpg is stored in the p2 folder. 2. Paths not starting with / are relative paths. For example, when the fileid value is p2/test2.jpg, it means a new p2 folder is created in the p1 folder, and then a file named test2.jpg is stored in the p2 folder. 3. Note: Do not end with /, otherwise an empty filename will occur. 4. To overwrite the original image with the repaired image, set the fileid field to <ObjectKey>. |
rule | String | Yes | Process parameter, example: ci-process=AIImageColoring. |
POST /<ObjectKey>?image_process HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateContent-length: SizeAuthorization: Auth StringPic-Operations:{"rules": [{"fileid": "exampleobject","rule": "ci-process=AIImageColoring"}]}
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 645Date: Tue, 23 Apr 2022 09:06:16 GMTStatus: 200 OKServer: tencent-cix-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****<UploadResult><OriginalInfo><Key>ObjectKey</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/filename.jpg</Location><ETag>"ed60e3598e6862d8c8443a06acfb2153"</ETag></OriginalInfo><ProcessResults><Object><Key>exampleobject</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location><Format/><Size>354256</Size><ETag>"521451f63c331becf533e466732c1091"</ETag></Object></ProcessResults></UploadResult>
Feedback