tencent cloud

Feedback

Blind Watermark

Last updated: 2024-03-04 10:35:11

    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();
    // Do not return the input image
    o["is_pic_info"] = 0;
    JArray rules = new JArray();
    JObject rule = new JObject();
    rule["bucket"] = bucket;
    rule["fileid"] = key;
    // Processing parameters. For rules, visit https://www.tencentcloud.com/document/product/436/46782?from_cn_redirect=1.
    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);
    // Execute the request
    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);
    // Processing parameters. For rules, visit https://www.tencentcloud.com/document/product/436/46782?from_cn_redirect=1.
    getObjectRequest.SetQueryParameter("watermark/3/type/<type>/image/<imageUrl>/text/<text>", null);
    
    GetObjectResult result = cosXml.GetObject(getObjectRequest);
    Note:
    For more complete samples, visit GitHub.
    
    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 avaliable.

    7x24 Phone Support