- //创建一个UIImage对象
-     UIImage *image = [UIImage imageNamed:@"scene1.jpg"];
- //1.建立bitmap Context
-     UIGraphicsBeginImageContext(image.size);
- //2.把原图绘制到context上
-     [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
- //3.把水印文字绘制到context上。
- //在左下角加水印
-     CGRect textFrame = CGRectMake(0, image.size.height-40, 200, 40);
- //设置水印文字属性
-     UIFont *font = [UIFont boldSystemFontOfSize:30];
-     NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
-     style.alignment = NSTextAlignmentCenter;
-     
-     UIColor *color = [UIColor colorWithRed:254.0/255 green:201.0/255 blue:21.0/255 alpha:1];
-     
-     [text drawInRect:textFrame withAttributes:
-      @{NSFontAttributeName:font,
-        NSForegroundColorAttributeName:color,
-        NSParagraphStyleAttributeName:style}];
- //4.从bitmap context上获取加了水印以后的图片。
-     UIImage *waterImage = UIGraphicsGetImageFromCurrentImageContext();
- //5.关闭bitmap context。
-     UIGraphicsEndImageContext();
- //6.返回获取的图片
-     return waterImage;
-  
-  
- 此方法最好独立成一个单独的类,只需一类方法就能完成。
图片添加水印效果
原文:http://www.cnblogs.com/SilverWinter/p/4423429.html