七牛图片盲水印
注意
調(diào)用形式
資源
http://i.iamlj.com/19-08-12/123936.png
處理參數(shù)
watermark/6/method/encode/text/aGVsbG8gcWluaXU=
新圖
http://i.iamlj.com/19-08-12/123936-watermark-qiniu.png
請求查詢
http://api.qiniu.com/status/get/prefop?id=z0.0A22344225B94C93025D536035EC1E3C
加密結(jié)果圖
https://i.iamlj.com/19-08-12/123936-watermark-qiniu.png
加密結(jié)果圖對比原圖,得出加密參數(shù)圖
http://7xlv47.com0.z0.glb.clouddn.com/upload.jpg
Pfop 請求生成新圖
Java 編碼代碼參考
package me.lj.qiniu.dora;import com.qiniu.common.QiniuException; import com.qiniu.common.Zone; import com.qiniu.processing.OperationManager; import com.qiniu.storage.Configuration; import com.qiniu.util.Auth; import com.qiniu.util.UrlSafeBase64; import me.lj.qiniu.config.Config;import java.io.IOException;/*** 圖片另存為*/ public class PfopsImageWatermark {public static void main(String args[]) throws IOException {//設(shè)置好賬號的ACCESS_KEY和SECRET_KEYString ACCESS_KEY = Config.ACCESS_KEY;String SECRET_KEY = Config.SECRET_KEY;//資源所在空間String bucketname = "image";String key = "19-08-12/123936.png";//上傳后的文件名String newKey = "19-08-12/123936-watermark-qiniu.png";//設(shè)置轉(zhuǎn)碼操作參數(shù)String fops = "watermark/6/method/encode/text/cWluaXU=";//設(shè)置轉(zhuǎn)碼的隊(duì)列String pipeline = "12349";//可以對轉(zhuǎn)碼后的文件進(jìn)行使用saveas參數(shù)自定義命 名,當(dāng)然也可以不指定文件會默認(rèn)命名并保存在當(dāng)前空間。String urlbase64 = UrlSafeBase64.encodeToString(bucketname + ":" + newKey);String pfops = fops + "|saveas/" + urlbase64;//密鑰配置Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);//第二種方式: 自動識別要上傳的空間(bucket)的存儲區(qū)域是華東、華北、華南。Zone z = Zone.autoZone();Configuration c = new Configuration(z);OperationManager operationManager = new OperationManager(auth, c);String id = null;try {id = operationManager.pfop(bucketname, key, pfops, pipeline, true);} catch (QiniuException e) {e.printStackTrace();}System.out.println(id);}}Java 解碼代碼參考
/*** 圖片另存為*/ public class PfopsImageWatermarkDecode {public static void main(String args[]) throws IOException {//設(shè)置好賬號的ACCESS_KEY和SECRET_KEYString ACCESS_KEY = Config.ACCESS_KEY;String SECRET_KEY = Config.SECRET_KEY;//資源所在空間String bucketname = "image";String originkey = "19-08-12/123936.png";String key = "19-08-12/123936-watermark-qiniu.png";//上傳后的文件名String newKey = "19-08-12/123936-watermark-compare.png";//設(shè)置轉(zhuǎn)碼操作參數(shù)String fops = "watermark/6/method/decode/orignal/"+UrlSafeBase64.encodeToString(originkey);;//設(shè)置轉(zhuǎn)碼的隊(duì)列String pipeline = "12349";//可以對轉(zhuǎn)碼后的文件進(jìn)行使用saveas參數(shù)自定義命 名,當(dāng)然也可以不指定文件會默認(rèn)命名并保存在當(dāng)前空間。String urlbase64 = UrlSafeBase64.encodeToString(bucketname + ":" + newKey);String pfops = fops + "|saveas/" + urlbase64;//密鑰配置Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);//第二種方式: 自動識別要上傳的空間(bucket)的存儲區(qū)域是華東、華北、華南。Zone z = Zone.autoZone();Configuration c = new Configuration(z);OperationManager operationManager = new OperationManager(auth, c);String id = null;try {id = operationManager.pfop(bucketname, key, pfops, pipeline, true);} catch (QiniuException e) {e.printStackTrace();}System.out.println(id);}}解碼結(jié)果圖
參考
盲水印處理
轉(zhuǎn)載于:https://www.cnblogs.com/shliujing/p/qi-niu-tu-pian-mang-shui-yin.html
總結(jié)
- 上一篇: 国科金:共融机器人基础理论与关键技术研究
- 下一篇: 不能头脑一热,就布局颠覆性技术、上马未来