****图片 水印

#import "HMViewController.h"

@interface HMViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView; @end @implementation HMViewController - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib. UIImage *oldImage = [UIImage imageNamed:@"img"]; // 开启上下文
// size 新的图片大小
// opaque YES 不透明 NO 透明
UIGraphicsBeginImageContextWithOptions(oldImage.size, NO, 0.0);
[oldImage drawAtPoint:CGPointZero]; NSString *text = @"我要高薪 !";
NSDictionary *dict = @{
NSFontAttributeName : [UIFont systemFontOfSize:],
NSForegroundColorAttributeName : [UIColor redColor] };
[text drawAtPoint:CGPointMake(, ) withAttributes:dict]; // 获取新的图片
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); // 关闭上下文
UIGraphicsEndImageContext(); _imageView.image = newImage; // 把图片转换成png格式的二进制数据
NSData *data = UIImagePNGRepresentation(newImage); // 写入桌面
[data writeToFile:@"/Users/apple/Desktop/newImage.png" atomically:YES]; } - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

IOS第17天(1,Quartz2D图片水印)的更多相关文章

  1. iOS UI进阶-1.1 Quartz2D 图片水印/裁剪/截图

    图片水印 UIImage+MJ.h #import <UIKit/UIKit.h> @interface UIImage (MJ) /** * 打水印 * * @param bg 背景图片 ...

  2. IOS第17天(2,Quartz2D图片剪裁变圆行图,和截屏图片)

    **** #import "HMViewController.h" #import "UIImage+Tool.h" @interface HMViewCont ...

  3. iOS边练边学--(Quartz2D)图片裁剪,带圆环的裁剪

    一.图片裁剪,示意图 二.带圆环的图片裁剪示意图

  4. iOS边练边学--(Quartz2D)图片添加水印

    一.给图片添加水印的基本步骤 加载图片 手动创建位图上下文 绘制原生的图片 给原生的图片添加文字 生成一张图片给我们,从上下文中获取图片 关闭上下文 二.注意:位图上下文的获取方式跟layer上下文不 ...

  5. IOS 绘制图片水印(封装)

    - (void)viewDidLoad { [super viewDidLoad]; // -1.加载图片 // UIImage *image = [UIImage imageNamed:@" ...

  6. Swift - 给图片添加图片水印(图片上绘制另一张图,并可设透明度)

    我前面写了篇文章讲解如何给图片添加文字水印,而如果想要添加图片类型的水印也很简单,只要把原来代码里添加文字的部分改成图片即可. 1,效果图如下: (在图片左上角添加了一个半透明的logo图片) 2,为 ...

  7. C#图片水印代码整理

    这一段公司有个项目,客户要求上传的图片要带上自定义的水印.以前也经常和朋友讨论C#图片水印方面的问题,但是从来没有实际操作过.所以,借这次项目的机会也研究了一下C#图片水印的功能!本人参考的是disc ...

  8. 开发笔记:PDF生成文字和图片水印

    背景 团队手里在做的一个项目,其中一个小功能是用户需要上传PDF文件到文件服务器上,都是一些合同或者技术评估文档,鉴于知识版权和防伪的目的,需要在上传的PDF文件打上水印, 这时候我们需要提供能力给客 ...

  9. webform:图片水印、验证码制作

    一.图片水印 1:引命名空间System.Drawing; 前端代码 <div> <asp:FileUpload ID="FileUpload1" runat=& ...

随机推荐

  1. AOP动态代理解析4-代理的创建

    做完了增强器的获取后就可以进行代理的创建了 AnnotationAwareAspectJAutoProxyCreator->postProcessAfterInitialization-> ...

  2. Docker中搭建Hadoop-2.6单机伪分布式集群

    1 获取一个简单的Docker系统镜像,并建立一个容器. 1.1 这里我选择下载CentOS镜像 docker pull centos 1.2 通过docker tag命令将下载的CentOS镜像名称 ...

  3. MFC MSBDutyTable下载地址

    点击此处跳转到下载地址 简明教程: 对于非制表人,只需要添加空余时间-新建,然后点星期和节数有课的那个按钮,勾选自己有课的周数.全部勾好后,生成空余时间表.然后查看自己的空余时间表,并导出,发给制表人 ...

  4. python 代码片段17

    #coding=utf-8 try: get_mutex() do_some_stuff() except (IndexError,KeyError,AttributeError),e: log(&q ...

  5. ubuntu下命令行禁用笔记本触摸板

    机房电脑不好用,所以用笔记本,但是由于笔记本过分紧凑手经常让鼠标不知道跑哪里去.于是找到了这两个命令 禁用:sudo rmmod psmouse 启用:sudo modprobe psmouse 非常 ...

  6. ios编译ASIHTTPRequest时出现 'libxml/HTMLparser.h' file not found in ASIHTTPRequest

    解决方法是添加libxml2.dylib 然后在Build Settings 中的 Header Search Paths 添加: ${SDK_DIR}/usr/include/libxml2

  7. ACM: HDU 5285 wyh2000 and pupil-二分图判定

     HDU 5285  wyh2000 and pupil Time Limit:1500MS     Memory Limit:65536KB     64bit IO Format:%I64d &a ...

  8. [Leetcode] Word BreakII

    Question: Given a string s and a dictionary of words dict, add spaces in s to construct a sentence w ...

  9. My Notepad

    I have spent near more two weeks to write this Notepad application. At this moment, I want to share ...

  10. IntelliSense: namespace "osgDB" 没有成员 "BEGIN_BRACKET"

    IntelliSense: namespace "osgDB" 没有成员 "BEGIN_BRACKET" 转自:http://bbs.osgchina.org/ ...