API | 操作描述 |
盲水印 | 对本地图片添加或提取盲水印并上传至存储桶 |
List<PicOperationRule> rules = new LinkedList<>();// 添加一条将盲水印 rule,处理后的图片在存储桶中的位置标识符为// 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);// 上传成功后,您将会得到 2 张图片,分别是原始图片和处理后图片COSXMLUploadTask cosxmlUploadTask = transferManager.upload(putObjectRequest, uploadId);
GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, cosPath, savePathDir, savedFileName);// 添加文字盲水印getObjectRequest.addQuery("watermark/3/type/3/text/dGVuY2VudCBjbG91ZA==", null);COSXMLDownloadTask cosxmlDownloadTask =transferManager.download(applicationContext, getObjectRequest);
本页内容是否解决了您的问题?