cos:GetObject, ci:CreateImageRepairJob.cos:PutObject.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).GET /<ObjectKey>?ci-process=ImageRepair HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>
Parameter | Meaning | Type | Required or Not |
ObjectKey | object filename, for example: folder/document.jpg | String | Yes |
ci-process | CI processing capability, image logo removal fixed as ImageRepair | String | Yes |
MaskPic | mask (region location in the image that needs to be removed), image address, private images must carry a signature, required to pass through URL-safe Base64 encoding. For example, if the mask image is http://examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/shuiyin_2.png, the encoded string at this location is aHR0cDovL2V4YW1wbGVidWNrZXQtMTI1MDAwMDAwMC5jb3MuYXAtZ3Vhbmd6aG91Lm15cWNsb3VkLmNvbS9zaHVpeWluXzIucG5n | String | No |
MaskPoly | For example: [[[608, 794], [1024, 794], [1024, 842], [608, 842]],[[1295, 62], [1295, 30], [1597, 32],[1597,64]]]. Enter the coordinates of each point of the polygon in clockwise order. Each polygon: [[x1, y1], [x2, y2]...], in the form of a 3D matrix (multiple polygons: [polygon1, polygon2]) or a 2D matrix (single polygon), and required to pass through URL-safe Base64 encoding. When MaskPoly is filled in simultaneously with MaskPic, the value of MaskPic takes precedence. | String | No |
HTTP/1.1 200 OKContent-Type: image/pngContent-Length: 98645Date: Tue, 23 Apr 2022 09:06:16 GMTStatus: 200 OKServer: tencent-cix-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****[pic-content]
PUT /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: <Auth String>Pic-Operations: <PicOperations>
Header Name | Description | Type |
Pic-Operations | Parameters for image operations | String |
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. |
Parameter Name | Type | Required or Not | Description |
bucket | String | No | Destination bucket name for storing results, in the format 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 file path and filename of the source file are: /p1/test1.jpgAn 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. A path not starting with / is a relative path. For example, when the fileid value is p2/test2.jpg, it means a new p2 folder is created in the p1 folder, and a file named test2.jpg is stored in the p2 folder. Do not end with /, as this will result in an empty filename. If you want the repaired image to overwrite the original image, set the fileid field to <ObjectKey>. |
rule | String | Yes | Processing parameters, ci-process = ImageRepair&MaskPic = <MaskPic> & MaskPoly = <MaskPoly>, specific parameter descriptions are in the table below |
Parameter Name | Description | Type | Required or Not |
ci-process | CI processing capability, image logo removal fixed as ImageRepair | String | Yes |
MaskPic | mask (region location to be removed in the image) image address, private images must carry a signature, and must be processed through URL-safe Base64 encoding. For example, if the mask image is http://examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/shuiyin_2.png, the encoded string here is aHR0cDovL2V4YW1wbGVidWNrZXQtMTI1MDAwMDAwMC5jb3MuYXAtZ3Vhbmd6aG91Lm15cWNsb3VkLmNvbS9zaHVpeWluXzIucG5n | String | No |
MaskPoly | For example: [[[608, 794], [1024, 794], [1024, 842], [608, 842]],[[1295, 62], [1295, 30], [1597, 32],[1597,64]]]. Enter the coordinates of each point of the polygon in clockwise order. Each polygon: [[x1, y1], [x2, y2]...], in the form of a 3D matrix (multiple polygons: [polygon1, polygon2]) or a 2D matrix (single polygon), and required to pass through URL-safe Base64 encoding. When MaskPoly is filled in simultaneously with MaskPic, the value of MaskPic takes precedence. | String | No |
Node Name (Keyword) | Parent Node | Description | Type |
UploadResult | None. | Request result. | Container |
Node Name (Keyword) | Parent Node | Description | Type |
OriginalInfo | UploadResult | Image information | Container |
ProcessResults | UploadResult | Request processing result | Container |
Node Name | Parent Node | Description | Type |
Key | OriginalInfo | Original image filename | String |
Location | OriginalInfo | Image path | String |
Node Name (Keyword) | Parent Node | Description | Type |
Object | ProcessResults | The processing result of each image | Container |
Node Name (Keyword) | Parent Node | Description | Type |
Key | Object | Repaired image file name | String |
Location | Object | Repaired image link | String |
ETag | Object | Repaired image ETag value | String |
Size | Object | Image size | Int |
PUT /filename.jpg HTTP/1.1Host: examplebucket-1250000000.cos.ap-chengdu.myqcloud.comDate: Wed, 28 Oct 2015 20:32:00 GMTAuthorization: Auth StringPic-Operations: {"rules":[{"fileid":"test.jpg","rule":"ci-process=ImageRepair&MaskPic=aHR0cDovL3BldGVyLWd6LTEyNTE3MDQ3MDguY29zLmFwLWd1YW5nemhvdS5teXFjbG91ZC5jb20vcGljX21hc2suanBn"}]}Content-Length: 64[Image Content]
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 645Date: Tue, 03 Apr 2018 09:06:16 GMTStatus: 200 OKx-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****<UploadResult><OriginalInfo><Key>456.jpeg</Key><Location>examplebucket-1250000000.cos.ap-chongqing.myqcloud.com/456.jpeg</Location></OriginalInfo><ProcessResults><Object><Key>test.jpg</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/test.jpg</Location><ETag>"eaa4e3d8fd498bbc63be3b71c46b9c61f23e3f0c"</ETag></Object></ProcessResults></UploadResult>
POST /<ObjectKey>?image_process HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations: <PicOperations>
Parameter Name | Description | Type |
ObjectKey | Image name to be fixed, must be a filename stored in COS, for example folder/sample.jpg | String |
Header Name | Description | Type |
Pic-Operations | Parameters for image operations | String |
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. |
Parameter Name | Type | Required or Not | Description |
bucket | String | No | Destination bucket name for storing results, in the format 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 file path and filename of the source file are: /p1/test1.jpgAn 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. A path not starting with / is a relative path. For example, when the fileid value is p2/test2.jpg, it means a new p2 folder is created in the p1 folder, and a file named test2.jpg is stored in the p2 folder. Do not end with /, as this will result in an empty filename. To overwrite the original image with the repaired one, set the fileid field to <ObjectKey>. |
rule | String | Yes | Processing parameters, ci-process = ImageRepair&MaskPic = <MaskPic> & MaskPoly = <MaskPoly>, specific parameter descriptions are in the table below |
Parameter Name | Description | Type | Required or Not |
ci-process | CI processing capability, image logo removal fixed as ImageRepair | String | Yes |
MaskPic | mask (region location to be removed in the image) image address, private images must carry a signature and must undergo URL-safe Base64 encoding. For example, if the mask image is http://examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/shuiyin_2.png, the encoded string here is aHR0cDovL2V4YW1wbGVidWNrZXQtMTI1MDAwMDAwMC5jb3MuYXAtZ3Vhbmd6aG91Lm15cWNsb3VkLmNvbS9zaHVpeWluXzIucG5n | String | No |
MaskPoly | For example: [[[608, 794], [1024, 794], [1024, 842], [608, 842]],[[1295, 62], [1295, 30], [1597, 32],[1597,64]]]. Enter the coordinates of each point of the polygon in clockwise order. Each polygon: [[x1, y1], [x2, y2]...], in the form of a 3D matrix (multiple polygons: [polygon1, polygon2]) or a 2D matrix (single polygon), and required to pass through URL-safe Base64 encoding. When MaskPoly is filled in simultaneously with MaskPic, the value of MaskPic takes precedence. | String | No |
Node Name (Keyword) | Parent Node | Description | Type |
UploadResult | None. | Request result. | Container |
Node Name (Keyword) | Parent Node | Description | Type |
OriginalInfo | UploadResult | Image information | Container |
ProcessResults | UploadResult | Request processing result | Container |
Node Name | Type | Description |
Key | String | Original image filename |
Location | String | Image path |
Node Name (Keyword) | Parent Node | Description | Type |
Object | ProcessResults | The processing result of each image | Container |
Node Name (Keyword) | Parent Node | Description | Type |
Key | Object | Repaired image file name | String |
Location | Object | Repaired image link | String |
ETag | Object | Repaired image ETag value | String |
Size | Object | Image size | Int |
POST /filename.jpg?image_process HTTP/1.1Host: examplebucket-1250000000.cos.ap-chengdu.myqcloud.comDate: Wed, 28 Oct 2015 20:32:00 GMTAuthorization: Auth StringPic-Operations: {"rules":[{"fileid":"bigpic_process.jpg","rule":"ci-process=ImageRepair&MaskPic=aHR0cDovL3BldGVyLWd6LTEyNTE3MDQ3MDguY29zLmFwLWd1YW5nemhvdS5teXFjbG91ZC5jb20vcGljX21hc2suanBn"}]}Content-Length: 0
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 645Date: Tue, 03 Apr 2018 09:06:16 GMTStatus: 200 OKx-cos-request-id: NWFjMzQ0MDZfOTBmYTUwXzZkZV8z****<UploadResult><OriginalInfo><Key>456.jpeg</Key><Location>examplebucket-1250000000.cos.ap-chongqing.myqcloud.com/456.jpeg</Location></OriginalInfo><ProcessResults><Object><Key>bigpic_process.jpeg</Key><Location>examplebucket-1250000000.cos.ap-chongqing.myqcloud.com/bigpic_process.jpeg</Location><Format/><Size>288132</Size><ETag>"fa2a3d6081c1037f154401a64eec4b19"</ETag></Object></ProcessResults></UploadResult>
Feedback