tencent cloud

All product documents
Cloud Object Storage
Blind Watermarking
Last updated: 2024-06-25 10:53:14
Blind Watermarking
Last updated: 2024-06-25 10:53:14

Overview

This document provides an overview of APIs and SDK code samples related to COS blind watermarking.
API
Description
Blind watermarking
Adds blind watermarks to or extracts blind watermarks from local images and uploads them to a bucket

SDK API References

For the parameters and method descriptions of all the APIs in the SDK, see SDK API Reference.

Adding Blind Watermarks

Description

COS allows you to add a blind watermark when uploading or downloading an object.

Sample 1. Adding a blind watermark when uploading

List<PicOperationRule> rules = new LinkedList<>();
// Add a rule for blind watermarking, and the processed image will be saved in the bucket with a location identifier in the format:
// examplewatermarkobject
rules.add(new PicOperationRule("examplewatermarkobject",
"watermark/3/type/1/image/aHR0cDovL2V4YW1wbGVzLTEyNTEwMDAw"));
PicOperations picOperations = new PicOperations(true, rules);

PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, cosPath, srcPath);
putObjectRequest.setPicOperations(picOperations);

// If the upload is successful, you will get 2 images: the original and the processed images
COSXMLUploadTask cosxmlUploadTask = transferManager.upload(putObjectRequest, uploadId);
Note:
For more samples, please visit GitHub.

Sample 2. Adding a blind watermark when downloading

GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, cosPath, savePathDir, savedFileName);
// Add a text watermark
getObjectRequest.addQuery("watermark/3/type/3/text/dGVuY2VudCBjbG91ZA==", null);

COSXMLDownloadTask cosxmlDownloadTask =
transferManager.download(applicationContext, getObjectRequest);
Note:
For more samples, please visit GitHub.
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