Overview
This document provides an overview of APIs and SDK code samples for 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
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.
Apakah halaman ini membantu?