API | Description |
Blind watermarking | Adds blind watermarks to or extracts blind watermarks from local images and uploads them to a bucket |
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:// examplewatermarkobjectrules.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 imagesCOSXMLUploadTask cosxmlUploadTask = transferManager.upload(putObjectRequest, uploadId);
GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, cosPath, savePathDir, savedFileName);// Add a text watermarkgetObjectRequest.addQuery("watermark/3/type/3/text/dGVuY2VudCBjbG91ZA==", null);COSXMLDownloadTask cosxmlDownloadTask =transferManager.download(applicationContext, getObjectRequest);
Was this page helpful?