GET /<ObjectKey>?watermark/1/image/<encodedURL>/gravity/<gravity>/dx/<dx>/dy/<dy>/blogo/<type> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>
PUT /<ObjectKey> HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateAuthorization: Auth StringPic-Operations:{"is_pic_info": 1,"rules": [{"fileid": "exampleobject","rule": "watermark/1/image/<encodedURL>/gravity/<gravity>/dx/<dx>/dy/<dy>/blogo/<type>"}]}
POST /<ObjectKey>?image_process HTTP/1.1Host: <BucketName-APPID>.cos.<Region>.myqcloud.comDate: GMT DateContent-length: SizeAuthorization: Auth StringPic-Operations:{"is_pic_info": 1,"rules": [{"fileid": "exampleobject","rule": "watermark/1/image/<encodedURL>/gravity/<gravity>/dx/<dx>/dy/<dy>/blogo/<type>"}]}
参数 | 含义 |
ObjectKey | 对象文件名,例如 folder/sample.jpg。 |
/image/ | 水印图片地址,需要经过 URL 安全的 Base64 编码。例如,水印图片为 http://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/shuiyin_2.png ,则该处编码后的字符串为aHR0cDovL2V4YW1wbGVidWNrZXQtMTI1MDAwMDAwMC5jb3MuYXAtc2hhbmdoYWkubXlxY2xvdWQuY29tL3NodWl5aW5fMi5wbmc |
/gravity/ | |
/dx/ | 水平(横轴)边距,单位为像素,缺省值为0 |
/dy/ | 垂直(纵轴)边距,单位为像素,默认值为0 |
/blogo/ | 水印图适配功能,适用于水印图尺寸过大的场景(如水印墙)。一共有两种类型: 当 blogo 设置为1时,水印图会被缩放至与原图相似大小后添加 当 blogo 设置为2时,水印图会被直接裁剪至与原图相似大小后添加 |
/scatype/ | 根据原图的大小,缩放调整水印图的大小: 当 scatype 设置为1时,按原图的宽缩放 当 scatype 设置为2时,按原图的高缩放 当 scatype 设置为3时,按原图的整体面积缩放 |
/spcent/ | 与 scatype 搭配使用: 当 scatype 设置为1时,该有效值为[1, 1000],单位为千分比 当 scatype 设置为2时,该有效值为[1, 1000],单位为千分比 当 scatype 设置为3时,该有效值为[1, 250],单位为千分比。 示例: http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?watermark/1/image/xxxxxxx/scatype/3/spcent/250 |
/dissolve/ | 图片水印的透明度,取值为1 - 100,默认90(90%不透明度) |
/batch/ | 平铺水印功能,可将图片水印平铺至整张图片。值为1时,表示开启平铺水印功能 |
/degree/ | 当 batch 值为1时生效。图片水印的旋转角度设置,取值范围为0 - 360,默认0 |
examplebucket-1250000000.file.myqcloud.com/shuiyin_2.png
不可用 ),且需保证水印图可访问(如果水印图读取权限为私有,则需要携带有效签名)。http://
开始,不能省略 HTTP 头,也不能填 HTTPS 头,例如examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/shuiyin_2.png
,https://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/shuiyin_2.png
为非法的水印 URL。http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn/gravity/southeast
https://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn/gravity/southeast/batch/1/degree/45/dissolve/40/
http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?q-sign-algorithm=<signature>&watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn/gravity/southeast
http://examples-1251000004.cos.ap-shanghai.myqcloud.com/sample.jpeg?q-sign-algorithm=sha1&q-ak=AKID********************&q-sign-time=1593342360;1593342720&q-key-time=1593342360;1593342720&q-header-list=&q-url-param-list=watermark%252f1%252fimage%252fahr0cdovl2v4yw1wbgvzlteyntewmdawmdqucgljc2gubxlxy2xvdwquy29tl3nodwl5aw4uanbn%252fgravity%252fsoutheast&q-signature=26a429871963375c88081ef60247c5746e834a98&watermark/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn/gravity/southeast
本页内容是否解决了您的问题?