tencent cloud

Feedback

Blind Watermarking

Last updated: 2022-01-23 12:51:17

    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.

    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