Pic-Operations
to the request header and use blind watermarking parameters.PUT /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations: <PicOperations>[Object Content]
Pic-Operations
(a JSON string) to the request header. Its parameters are as follows:Parameter | Description | Type | Required |
is_pic_info | Whether to return the input image information 0 (default): no 1 : yes | Int | No |
rules | Processing rules (up to five rules are supported). Each rule corresponds to one processing result. If this parameter is not specified, images will not be processed. | Array | No |
rules
(a JSON array) are as follows:Parameter | Description | Type | Required |
bucket | Name of the destination bucket to store the results, formatted as BucketName-APPID . If this parameter is not specified, the results will be stored in the current bucket. | String | No |
fileid | The path and name of the output file The rules for setting this parameter are as follows (assume that the input file is stored in /p1/test1.jpg ):A value starting with a slash (/) indicates an absolute path. For example, if fileid is set to /p2/test2.jpg, the test2.jpg file will be stored in the p2 folder. A value not starting with a slash indicates a relative path. For example, if fileid is set to p2/test2.jpg, a folder named p2 is created in the p1 folder, and the test2.jpg file will be stored in the p2 folder. Note: Do not end the value with a slash. Otherwise, an empty filename will be generated. | String | Yes |
rule | Processing parameters. For more information, see the image processing API. To process an image using a specified style, the value must start with style/ with the style name followed. For example, if the style name is test , the value of rule should be style/test . | String | Yes |
watermark
to rule
as follows:watermark/3/type/<type>/image/<imageUrl>/text/<text>/level/<level>
Parameter | Description | Type | Required |
type | Blind watermarking type. Valid values: 1 (semi-blind watermarking), 2 (perfectly blind watermarking), 3 (text blind watermarking) | Int | Yes |
image | URL of the blind image watermark, which must be URL-safe Base64-encoded. This parameter is required if type is set to 1 or 2 , and does not take effect if type is set to 3 . The image watermark must:1. Be stored in the same bucket as the input image. 2. Have a URL that starts with http://. Note that "http://" cannot be omitted or changed to "https://". For example, the following watermark URLs are invalid: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png | String | No |
text | Text watermark, which must be URL-safe Base64-encoded. This parameter is required if type is set to 3 and does not take effect if type is set to 1 or 2 . | String | No |
level | Perfectly blind watermarking level, which only takes effect when type is set to 2 . Valid values: 1 (default), 2 , 3 . The larger the value, the better the watermarking effects. | Int | No |
Parameter | Description | Type |
UploadResult | Upload results | Container |
UploadResult
: Parameter | Description | Type |
OriginalInfo | Information about the input image | Container |
ProcessResults | Processing results | Container |
OriginalInfo
: Parameter | Description | Type |
Key | Name of the input image | String |
Location | Image location | String |
ImageInfo | Information about the input image | Container |
ImageInfo
: Parameter | Description | Type |
Format | Image format | String |
Width | Image width | Int |
Height | Image height | Int |
Quality | Image quality | Int |
Ave | Image average hue | String |
Orientation | Image rotation angle | Int |
ProcessResults
:Parameter | Description | Type |
Object | Processing results of each image | Container |
Object
:Parameter | Description | Type |
Key | Filename | String |
Location | Image location | String |
Format | Image format | String |
Width | Image width | Int |
Height | Image height | Int |
Size | Image size | Int |
Quality | Image quality | Int |
PUT /exampleobject HTTP/1.1Host: examplebucket-1250000000.cos.ap-chengdu.myqcloud.comDate: Tue, 03 Apr 2018 09:06:15 GMTAuthorization:XXXXXXXXXXXXPic-Operations:{"is_pic_info": 1,"rules": [{"fileid": "exampleobject","rule": "watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn"}]}Content-Length: 64[Object 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>exampleobject</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location><ImageInfo><Format>JPEG</Format><Width>640</Width><Height>427</Height><Quality>100</Quality><Ave>0xa18454</Ave><Orientation>1</Orientation></ImageInfo></OriginalInfo><ProcessResults><Object><Key>exampleobject</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location><Format>png</Format><Width>640</Width><Height>427</Height><Size>463092</Size><Quality>100</Quality></Object></ProcessResults></UploadResult>
imageUrl
in rule
in the request header Pic-Operations
is the URL of the image watermark.Location
in ProcessResults
in the response body is the URL of the image with a blind watermark.watermark
parameter after the image URL.GET /<ObjectKey>?watermark/3/type/<type>/image/<imageUrl>/text/<text> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>
Parameter | Description | Type | Required |
download_url | URL of the input image, formatted as http(s):// <BucketName-APPID>.cos.<Region>.myqcloud.com/<picture name> . Example: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/picture.jpeg | String | Yes |
type | Blind watermarking type. Valid values: 1 (semi-blind watermarking), 2 (perfectly blind watermarking), 3 (text blind watermarking) | Int | Yes |
image | URL of the blind image watermark, which must be URL-safe Base64-encoded. This parameter is required if type is set to 1 or 2 , and does not take effect if type is set to 3 . The image watermark must:1. Be stored in the same bucket as the input image. 2. Have a URL that starts with http://. Note that "http://" cannot be omitted or changed to "https://". For example, the following watermark URLs are invalid: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png | String | No |
text | Text watermark, which must be URL-safe Base64-encoded. This parameter is required if type is set to 3 and does not take effect if type is set to 1 or 2 . | String | No |
level | Perfectly blind watermarking level, which only takes effect when type is set to 2 . Valid values: 1 (default), 2 , 3 . The larger the value, the better the watermarking effects. | Int | No |
https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/sample.jpeg?watermark/3/type/3/text/dGVuY2VudCBjbG91ZA==
POST /<ObjectKey>?image_process HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations: <PicOperations>
Pic-Operations
(a JSON string) to the request header. Its parameters are as follows:Parameter | Description | Type | Required |
is_pic_info | Whether to return the input image information 0 (default): no 1 : yes | Int | No |
rules | Processing rules (up to five rules are supported). Each rule corresponds to one processing result. If this parameter is not specified, images will not be processed. | Array | No |
rules
(a JSON array) are as follows:Parameter | Description | Type | Required |
bucket | Name of the destination bucket to store the results, formatted as BucketName-APPID . If this parameter is not specified, the results will be stored in the current bucket. | String | No |
fileid | The path and name of the output file . The rules for setting this parameter are as follows (assume that the input file is stored in /p1/test1.jpg ):1. A value starting with a slash (/) indicates an absolute path. For example, if fileid is set to /p2/test2.jpg , the test2.jpg file will be stored in the p2 folder. 2. A value not starting with a slash indicates a relative path. For example, if fileid is set to p2/test2.jpg , a folder named p2 is created in the p1 folder, and the test2.jpg file will be stored in the p2 folder.3. Note: Do not end the value with a slash. Otherwise, an empty filename will be generated. | String | Yes |
rule | Processing parameters. For more information, see the image processing API. To process an image using a specified style, the value must start with style/ with the style name followed. For example, if the style name is test , the value of rule should be style/test . | String | Yes |
watermark
to rule
as follows:watermark/3/type/<type>/image/<imageUrl>/text/<text>/level/<level>
Parameter | Description | Type | Required |
type | Blind watermarking type. Valid values: 1 (semi-blind watermarking), 2 (perfectly blind watermarking), 3 (text blind watermarking) | Int | Yes |
image | URL of the blind image watermark, which must be URL-safe Base64-encoded. This parameter is required if type is set to 1 or 2 , and does not take effect if type is set to 3 . The image watermark must:1. Be stored in the same bucket as the input image. 2. Have a URL that starts with http:// . Note that "http://" cannot be omitted or changed to "https://". For example, the following watermark URLs are invalid: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png | String | No |
text | Text watermark, which must be URL-safe Base64-encoded. This parameter is required if type is set to 3 and does not take effect if type is set to 1 or 2 . | String | No |
level | Perfectly blind watermarking level, which only takes effect when type is set to 2 . Valid values: 1 (default), 2 , 3 . The larger the value, the better the watermarking effects. | Int | No |
Parameter | Description | Type |
UploadResult | Upload results | Container |
UploadResult
: Parameter | Description | Type |
OriginalInfo | Information about the input image | Container |
ProcessResults | Processing results | Container |
OriginalInfo
: Parameter | Description | Type |
Key | Name of the input image | String |
location | Location of the input image | String |
ImageInfo | Information about the input image | Container |
ImageInfo
: Parameter | Description | Type |
Format | Image format | String |
Width | Image width | Int |
Height | Image height | Int |
Quality | Image quality | Int |
Ave | Image average hue | String |
Orientation | Image rotation angle | Int |
ProcessResults
:Parameter | Description | Type |
Object | Processing results of each image | Container |
Object
:Parameter | Description | Type |
Key | Filename | String |
Location | Image location | String |
Format | Image format | String |
Width | Image width | Int |
Height | Image height | Int |
Size | Image size | Int |
Quality | Image quality | Int |
POST /exampleobject?image_process HTTP/1.1Host: examplebucket-1250000000.cos.ap-chengdu.myqcloud.comDate: Tue, 03 Apr 2018 09:06:15 GMTAuthorization:XXXXXXXXXXXXPic-Operations:{"is_pic_info": 1,"rules": [{"fileid": "exampleobject","rule": "watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn"}]}Content-Length: 64
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>exampleobject</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location><ImageInfo><Format>JPEG</Format><Width>640</Width><Height>427</Height><Quality>100</Quality><Ave>0xa18454</Ave><Orientation>1</Orientation></ImageInfo></OriginalInfo><ProcessResults><Object><Key>exampleobject</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject</Location><Format>png</Format><Width>640</Width><Height>427</Height><Size>463092</Size><Quality>100</Quality></Object></ProcessResults></UploadResult>
Pic-Operations
to the request header and use the watermark extraction parameter watermark/4
.PUT /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization:XXXXXXXXXXXXPic-Operations: <PicOperations>[Object Content]
Pic-Operations
(a JSON string) to the request header. Its parameters are as follows:Parameter | Description | Type | Required |
is_pic_info | Whether to return the input image information 0 (default): no 1 : yes | Int | No |
rules | Processing rules (up to five rules are supported). Each rule corresponds to one processing result. If this parameter is not specified, images will not be processed. | Array | No |
rules
(a JSON array) are as follows:Parameter | Description | Type | Required |
bucket | Name of the destination bucket to store the results, formatted as BucketName-APPID . If this parameter is not specified, the results will be stored in the current bucket. | String | No |
fileid | The path and name of the output file The rules for setting this parameter are as follows (assume that the input file is stored in /p1/test1.jpg ):1. A value starting with a slash (/) indicates an absolute path. For example, if fileid is set to /p2/test2.jpg , the test2.jpg file will be stored in the p2 folder. 2. A value not starting with a slash indicates a relative path. For example, if fileid is set to p2/test2.jpg , a folder named p2 is created in the p1 folder, and the test2.jpg file will be stored in the p2 folder.Note: Do not end the value with a slash. Otherwise, an empty filename will be generated. | String | Yes |
rule | Processing parameters. For more information, see the image processing API. To process an image using a specified style, the value must start with style/ with the style name followed. For example, if the style name is test , the value of rule should be style/test . | String | Yes |
watermark
parameter to rule
as follows:watermark/4/type/<type>/image/<imageUrl>
Parameter | Description | Type | Required |
type | Blind watermarking type. Valid values: 1 (semi-blind watermarking), 2 (perfectly blind watermarking), 3 (text blind watermarking). The value must be the same as that used when the blind watermark was added. | Int | Yes |
image | Image URL, which should be specified according to the value of type . If the value of type is: 1 , image is required and is the URL of the input image. 2 , image is required and is the URL of the image watermark. 3 , image does not need to be specified and will not take effect. The value of image must be URL-safe Base64-encoded, and the image must: 1. Be stored in the same bucket as the image with the blind watermark. 2. Have a URL that starts with http:// . Note that "http://" cannot be omitted or changed to "https://". For example, the following watermark URLs are invalid: examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/watermark.png | String | No |
WatermarkStatus
will be added to the UploadResult.ProcessResults.Object
node only if type
is set to 2
in the request body of the blind watermark extraction request.Parameter | Parent Node | Description | Type |
WatermarkStatus | Object | This parameter is returned if type is set to 2 to indicate the confidence of the watermark extracted. Value range: 0–100. If the value is greater than 75, there is a blind watermark. If the value falls in the range of 60−75, there is a suspected blind watermark. If the value is smaller than 60, no blind watermark is extracted. | Int |
PUT /exampleobject1 HTTP/1.1Host: examplebucket-1250000000.cos.ap-chengdu.myqcloud.comDate: Tue, 03 Apr 2018 09:06:15 GMTAuthorization:XXXXXXXXXXXXPic-Operations:{"is_pic_info": 1,"rules": [{"fileid": "exampleobject2","rule": "watermark/4/type/2/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL2ZpbGVuYW1lLmpwZWc="}]}Content-Length: 64[Object 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>exampleobject1</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject1</Location><ImageInfo><Format>JPEG</Format><Width>640</Width><Height>427</Height><Quality>100</Quality><Ave>0xa18454</Ave><Orientation>1</Orientation><FrameCount>1</FrameCount></ImageInfo></OriginalInfo><ProcessResults><Object><Key>exampleobject2</Key><Location>examplebucket-1250000000.cos.ap-chengdu.myqcloud.com/exampleobject2</Location><Format>png</Format><Width>640</Width><Height>427</Height><Size>463092</Size><Quality>100</Quality><FrameCount>1</FrameCount><WatermarkStatus>86</WatermarkStatus></Object></ProcessResults></UploadResult>
type
is set to 1
in the request, imageUrl
in rule
in Pic-Operations
is the URL of the input image without a blind watermark added. If type
is set to 2
in the request, imageUrl
is the URL of the image watermark.url
in ProcessResults
in the response body is the URL of the image watermark extracted.Pic-Operations
to the request header and use the watermark extraction parameter watermark/4
.
Apakah halaman ini membantu?