jpg转png
下面是测试图片结果:
// UIImage *image_jpg = [UIImage imageNamed:@"jpgtest.jpg"];
// UIImage *image_png = [UIImage imageNamed:@"pngtest-1.png"];
//
// NSData *data_pngfrompng = UIImagePNGRepresentation(image_png);
// NSData *data_pngfromjpg = UIImagePNGRepresentation(image_jpg);
// NSData *data_jpgfrompng = UIImageJPEGRepresentation(image_png, 0.5);
// NSData *data_jpgfromjpg = UIImageJPEGRepresentation(image_jpg, 0.5);
//
// NSString *documents = [NSHomeDirectory() stringByAppendingString:@"/Documents/"];
//
// NSString *pathpngfrompng = [documents stringByAppendingString:@"data_pngfrompng.png"];
// NSString *pathpngfromjpg = [documents stringByAppendingString:@"data_pngfromjpg.png"];
// NSString *pathjpgfrompng = [documents stringByAppendingString:@"data_jpgfrompng.jpg"];
// NSString *pathjpgfromjpg = [documents stringByAppendingString:@"data_jpgfromjpg.jpg"];
//
// [data_pngfrompng writeToFile:pathpngfrompng atomically:YES];
// [data_pngfromjpg writeToFile:pathpngfromjpg atomically:YES];
// [data_jpgfrompng writeToFile:pathjpgfrompng atomically:YES];
// [data_jpgfromjpg writeToFile:pathjpgfromjpg atomically:YES];
UIImage *image_jpg = [UIImage
imageNamed:@"2231249403.jpg"];
NSData *data_jpgfromjpg =
UIImageJPEGRepresentation(image_jpg, 0.5);
NSString *documents = [NSHomeDirectory()
stringByAppendingString:@"/Documents/"];
NSString *pathjpgfromjpg = [documents
stringByAppendingString:@"datcccc.jpg"];
[data_jpgfromjpg
writeToFile:pathjpgfromjpg
atomically:YES];
随机推荐
- [代码] 类似 YYText 将表情文本转换成表情字符
一,经历 1> 由于工作需要,得把 UITextView 中的属性文本转换成普通文字,并将处理后的普通文字转换成属性文本. 2> 将属性文本转换成普通文字简单,可以调用属性文本的enume ...
- hdu1232 并查集
1. hdu1232 2.链接:http://acm.hdu.edu.cn/showproblem.php?pid=1232 3.总结:简单并查集 #include<iostream> # ...
- java枚举使用详解
在实际编程中,往往存在着这样的“数据集”,它们的数值在程序中是稳定的,而且“数据集”中的元素是有限的. 例如星期一到星期日七个数据元素组成了一周的“数据集”,春夏秋冬四个数据元素组成了四季的“数据集” ...
- java&testng中Assert
用testng中的assert做断言时,如果断言失败,则在当前方法中失败的语句后的语句将不会再执行: 如图: 看控制台输出语句:
- Super Jumping! Jumping! Jumping!——E
E. Super Jumping! Jumping! Jumping! Time Limit: 1000ms Memory Limit: 32768KB 64-bit integer IO forma ...
- Oracle基础及三层分页查询
一.数据库表空间和数据文件 解析:一个数据库下可以开N个表空间,一个表空间可以包含N个数据文件.表空间是逻辑概念. 二.关于listener.ora位置 修改该界面上的数据,会影响指定路径的监听配置文 ...
- linux笔记六-------文件权限设置
1.文件(目录)权限本身划分:读read 写write 执行execute 权限从用户的角度划分:主人权限user 同组用户权限group 其他组用户的权限other music. ...
- iOS no visible @interface for 'UIButton' declares the selector errors
no visible @interface for 'UIButton' declares the selector errors 原理不是特别理解,通过清理缓存,代码更新了,Xcode还是读旧的缓 ...
- bootstrap 不兼容ie8 的问题
官方推荐的脚手架中,其实已经包含着解决方案:html5shiv.min.js .Respond.min.js 但由于respond.js 使用 file:// 协议,IE8 是无法调起本地文件的 ...
- phpexcel的写操作将数据库中的数据导入到excel中
这个版本据说是可以支持excel2007,但是我使用2007编辑的xlsx是无法获得该库的支持.于是乎我就将它转化为2003.感觉支持地很好. 下面介绍一下具体的使用: require_once('. ...