tencent cloud

masukan

Blind Watermarking

Terakhir diperbarui:2024-02-01 17:32:35

    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.
    Hubungi Kami

    Hubungi tim penjualan atau penasihat bisnis kami untuk membantu bisnis Anda.

    Dukungan Teknis

    Buka tiket jika Anda mencari bantuan lebih lanjut. Tiket kami tersedia 7x24.

    Dukungan Telepon 7x24