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];
随机推荐
- 【BZOJ】2879: [Noi2012]美食节
题意 \(m\)个厨师,\(n\)种菜,每种菜需要做\(p_i\)份,每个厨师做第\(i\)种菜用时\(t_{i, j}\).一个厨师做完一道菜才能做下一道.每份菜的时间是这个厨师做完这道菜的用时加上 ...
- 【BZOJ2438】 [中山市选2011]杀人游戏 tarjan强连通分量+缩点
Description 一位冷血的杀手潜入 Na-wiat,并假装成平民.警察希望能在 N 个人里面,查出谁是杀手. 警察能够对每一个人进行查证,假如查证的对象是平民,他会告诉警察,他认识的人, 谁是 ...
- 【POJ3461】Olipo
Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without t ...
- android注意事项
今天做安卓设计,正在学习布局.在过程中遇到了几个小问题,感觉非常有必要记录分享出来. 1.string字符串不要出现"that's" ,要使用“that is”要不然会报错. 2. ...
- 关于SASS--->推荐使用
作为前端(html.javascript.css)的三大马车之一的css,一直以静态语言存在,HTML5火遍大江南北了.javascript由于NODE.JS而成为目前前后端统一开发语言的不二之选.只 ...
- TCP/IP基础知识
TCP/IP基础知识 网络 TCP/IP 引言 本篇属于TCP/IP协议的基础知识,重点介绍了TCP/IP协议簇的内容.作用以及TCP.UDP.IP三种常见网络协议相关的基础知识. 内容 TCP/IP ...
- 【android studio】解决android studio drawable新建项目时只有一个drawable目录的问题
概述 android studio默认新建Module时,只新建一个drawable目录,并不会新建适配不同分辨率的drawable目录.但其实,这是可以设置的.有以下两种方法: 方法1 详细步骤 进 ...
- [LintCode] Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Have you met ...
- win7 、win10连接l2tpvpn
win7: 修改vpn连接选项: win10: 参考连接: http://service.njaf.gov.cn/26970/26971/201510/t20151024_3621861.html ...
- 数据库---T-SQL语句提纲
T-SQL语句: 创建表:create table Name(Code varchar(50)) 主键:primary key自增长列:auto_increment外键关系:references非空: ...