码迷,mamicode.com
首页 > 其他好文 > 详细

图片压缩

时间:2016-03-08 13:17:59      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:

用法: 
UIImage *yourImage= [self imageWithImageSimple:image scaledToSize:CGSizeMake(210.0, 210.0)]; 
// 压缩图片
- ( UIImage *)imageWithImageSimple:( UIImage *)image scaledToSize:( CGSize )newSize
{ // Create a graphics image context UIGraphicsBeginImageContext (newSize); // Tell the old image to draw in this newcontext, with the desired // new size [image drawInRect : CGRectMake ( 0 , 0 ,newSize. width ,newSize. height )]; // Get the new image from the context UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext (); // End the context UIGraphicsEndImageContext (); // Return the new image. return newImage; }

 

图片压缩

标签:

原文地址:http://www.cnblogs.com/Ganggang888/p/5253534.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!