博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ios 图片压缩
阅读量:4608 次
发布时间:2019-06-09

本文共 734 字,大约阅读时间需要 2 分钟。

1 //对图片尺寸进行压缩-- 2 -(UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize 3 { 4     // Create a graphics image context 5     UIGraphicsBeginImageContext(newSize); 6      7     // Tell the old image to draw in this new context, with the desired 8     // new size 9     [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];10     11     // Get the new image from the context12     UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();13     14     // End the context15     UIGraphicsEndImageContext();16     17     // Return the new image.18    return newImage;19 }
//按比例压缩NSData  *imageData = UIImageJPEGRepresentation(self.uploadImage , 0.75);

 

转载于:https://www.cnblogs.com/ubersexual/p/3410965.html

你可能感兴趣的文章
Java的内部类真的那么难以理解?
查看>>
一文搞懂Java环境,轻松实现Hello World!
查看>>
hash实现锚点平滑滚动定位
查看>>
也谈智能手机游戏开发中的分辨率自适应问题
查看>>
【转】MYSQL数据库设计规范与原则
查看>>
《中国大历史》—— 读后总结
查看>>
回溯法算法框架
查看>>
残差学习【转载】
查看>>
0302 关于IT行业的就业感想
查看>>
3、流程语句相关练习
查看>>
30、git 使用
查看>>
iOS网络-02-数据解析(JSON与XML)
查看>>
python列表求和的几种等效电路
查看>>
Luogu P3393 逃离僵尸岛
查看>>
Flatten Binary Tree to Linked List
查看>>
Edit Distance
查看>>
软件工程第一次作业补充
查看>>
N76E003---输入捕获
查看>>
poj 1094 Sorting It All Out(拓扑排序)
查看>>
acdream B - 郭式树 (水题 卡cin,cout, 卡LL)
查看>>