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];
随机推荐
- 【CodeVS】p1299 切水果
题目描述 Description 简单的说,一共N个水果排成一排,切M次,每次切[L,R]区间的所有水果(可能有的水果被重复切),每切完一次输出剩下水果数量 数据已重新装配,不会出现OLE错误 时限和 ...
- CSS_css sprite原理优缺点及使用
CSS Sprites在国内很多人叫css精灵,是一种网页图片应用处理方式.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢 ...
- Spring MVC和Struts2的比较(二)
1.Spring MVC的controller+command object模式比Struts2的Action模式更安全一些.而在Struts2中,自动数据绑定发生在Action对象上.这样,在Act ...
- Big Chocolate
Big Chocolate 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=19127 Big Chocolat ...
- Crossing River
Crossing River 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=26251 题意: N个人希望去过 ...
- css3动画在动作结束时保持该状态不变的解决办法
animation-fill-mode : none | forwards | backwards | both; none:不改变默认行为. forwards :当动画完成后,保持最后一个属性值(在 ...
- 如何给Sublime安装插件
第一步:点击链接http://sublime.wbond.net/Package%20Control.sublime-package下载Package Control. 第二步:点击打开Sublime ...
- jq最新前三篇文章高亮显示
/*---------最新前三篇文章高亮显示-------------*/ function latest(){ var color_arr=new Array( "blue", ...
- MVC概念性的内容
MVC: 是一个缩写(model + view + control), Model:是一些类文件, 功能:负责增删改查, 负责跟数据库打交道 (把数据存入到数据库: 从数据库把数据读 ...
- sql 数据库 初级 个人学习总结(一)
数据库个人总结(初级)1.增删改查 insert into 表名 values ('条件','条件2') delete from 表名 where 条件 update 表名 set=条件值 where ...