Overview
This document provides an overview of APIs and SDK code samples for blind watermarking.
SDK API References
For the parameters and method description of all the APIs in the SDK, see the API documentation. 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
PutObjectRequest request = new PutObjectRequest(bucket, key, srcPath);
JObject o = new JObject();
o["is_pic_info"] = 0;
JArray rules = new JArray();
JObject rule = new JObject();
rule["bucket"] = bucket;
rule["fileid"] = key;
rule["rule"] = "watermark/3/type/<type>/image/<imageUrl>/text/<text>/level/<level>";
rules.Add(rule);
o["rules"] = rules;
string ruleString = o.ToString(Formatting.None);
request.SetRequestHeader("Pic-Operations", ruleString);
PutObjectResult result = cosXml.PutObject(request);
Note:
For more complete samples, visit GitHub. Sample 2: Adding a blind watermark during download
GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, key, localDir, localFileName);
getObjectRequest.SetQueryParameter("watermark/3/type/<type>/image/<imageUrl>/text/<text>", null);
GetObjectResult result = cosXml.GetObject(getObjectRequest);
Note:
For more complete samples, visit GitHub.
Was this page helpful?