- (void)watermark {
uiimage *oldimage = [uiimage imagenamed:@"事先準備好的,你將要在這帳上新增水印"];
uigraphicsbeginimagecontextwithoptions(oldimage.size, no, 0.0);
[oldimage drawinrect:cgrectmake(0, 0, oldimage.size.width, oldimage.size.height)];
uiimage *waterimage = [uiimage imagenamed:@"這是您將要在事先準備好的上放置的logo"];
cgfloat waterw = 50;
cgfloat waterh = 25;
cgfloat waterx = oldimage.size.width - waterw - 5;
cgfloat watery = oldimage.size.height - waterh - 5;
cgrect waterrect = cgrectmake(waterx, watery, waterw, waterh);
[waterimage drawinrect:waterrect];
//得到最終的
uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext();
uigraphicsendimagecontext();
self.imageview.image = newimage;
nsdata *data = uiimagepngrepresentation(newimage);
[data writetofile:@"將弄好的儲存到的檔案路徑/名.png" atomically:yes];
iOS 新增水印
新增水印,這個需求要求調研時,因為是新的技術點,查閱了一些資料。資料中統統都說 獲取介面的rgb值,將需要加密的資訊翻譯成二進位制,通過位運算,新增到每個rgb值的二進位制末尾實現。解碼時線取介面的rgb二進位制值,通過位運算,得出加密資訊的二進位制即可。網上給了一些獲得介面rgb的方法,我按照其方...
Opencv 輸出文字,實現簡單水印
設定好opencv環境 1,包含標頭檔案 include cvxtext.h include cv.h include highgui.h include cxcore.h 2,工程 設定 連線 物件 庫模組 新增 cxcore.lib cv.lib cvaux.lib highgui.lib 3,...
Opencv 輸出文字,實現簡單水印
設定好opencv環境 1,包含標頭檔案 include cvxtext.h include cv.h include highgui.h include cxcore.h 2,工程 設定 連線 物件 庫模組 新增 cxcore.lib cv.lib cvaux.lib highgui.lib 3,...