tencent cloud

All product documents
Cloud Object Storage
Blind Watermark
Last updated: 2024-02-02 17:35:19
Blind Watermark
Last updated: 2024-02-02 17:35:19

Overview

This document provides an overview of APIs and SDK code samples for blind watermarking.
For blind watermark APIs, see Blind Watermarking.

Adding Blind Watermark

Feature description

You can add a blind watermark when uploading or downloading an object.

Sample 1: Adding a blind watermark during upload

<!-- DOM element on the HTLM page -->

<!-- Choose a file to upload -->
<input id="fileSelector" type="file" />
<!-- Click the button for upload-->
<input id="submitBtn" type="submit" />
function handleFileInUploading(file) {
cos.putObject(
{
Bucket: 'examplebucket-1250000000',
Region: 'COS_REGION',
Key: file.name,
Body: file,
Headers: {
// CI's persistent processing API during upload
'Pic-Operations':
'{"is_pic_info": 1, "rules": [{"fileid": "desample_photo.jpg", "rule": "watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn"}]}',
},
},
function (err, data) {
console.log(err || data);
},
);
}

document.getElementById('submitBtn').onclick = function (e) {
var file = document.getElementById('fileSelector').files[0];
if (!file) {
document.getElementById('msg').innerText = 'No file selected for upload';
return;
}
handleFileInUploading();
};

Sample 2: Adding a blind watermark during download

<!-- DOM element on the HTLM page -->

<!-- Click the button to download and process the image -->
<input id="submitBtn" type="submit" />
function getObject() {
cos.getObject(
{
Bucket: 'examplebucket-1250000000',
Region: 'COS_REGION',
Key: 'exampleobject',
QueryString: `watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAwMDQucGljc2gubXlxY2xvdWQuY29tL3NodWl5aW4uanBn`,
},
function (err, data) {
console.log(err || data);
},
);
}
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon