iOS读取图片数据的两种方法:UIImageJPEG和UIImagePNG
2016-05-26 15:50
483 查看
UIImageJPEGRepresentation函数有两个参数:引用的图片和压缩系数.
UIImagePNGRepresentation(UIImage * image)函数只有一个引用图片参数.
UIImagePNGRepresentation(UIImage * image)要比UIImageJPEGPresentation(UIImage * image, 1.0)返回的图片数据量大很多,如果对图片清晰度要求不高,可以通过设置UIImageJPEGReprentation的第二个参数,大幅度降低图片数据量.
还可以用来比较是否是同一图片
![](http://images2015.cnblogs.com/blog/897044/201604/897044-20160401000533613-734475230.png)
UIImagePNGRepresentation(UIImage * image)函数只有一个引用图片参数.
UIImagePNGRepresentation(UIImage * image)要比UIImageJPEGPresentation(UIImage * image, 1.0)返回的图片数据量大很多,如果对图片清晰度要求不高,可以通过设置UIImageJPEGReprentation的第二个参数,大幅度降低图片数据量.
还可以用来比较是否是同一图片
![](http://images2015.cnblogs.com/blog/897044/201604/897044-20160401000533613-734475230.png)
相关文章推荐
- 关于UI界面上的坐标
- UIScrollView属性
- UIView层次管理
- 用户账号-用户标识符:UID与GID
- 严重: Exception occurred during processing request: Position beyond number of declared ordinal paramet
- ngui 和粒子层级问题
- Cell简介和UITableViewCell的contentView
- UGUI里面button的移动
- iOS UITableView - beginUpdates和endUpdates方法说明
- UGUI的下拉菜单
- iOS开发之窥探UICollectionViewController(五) --一款炫酷的图片浏览组件
- iOS开发之窥探UICollectionViewController(四) --一款功能强大的自定义瀑布流
- iOS开发之窥探UICollectionViewController(三) --使用UICollectionView自定义瀑布流
- iOS开发之窥探UICollectionViewController(一) -- Ready Your CollectionViewController
- priority_queue的使用
- Please use the /MD switch for _AFXDLL builds错误
- iOS开发之使用Storyboard预览UI在不同屏幕上的运行效果
- iOS开发之多线程技术(NSThread、OperationQueue、GCD)
- UIScrollView无法滚动,可能是以下原因
- 在Java中连接字符串时是使用+号还是使用StringBuilder