首页 > 移动平台 > 详细

iOS:压缩图片

时间:2015-03-23 15:27:14      阅读:249      评论:0      收藏:0      [点我收藏+]
UIImage*img= [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;
}   

iOS:压缩图片

原文:http://blog.csdn.net/u013243469/article/details/44563323

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!