在iphone中减少相机/照片库图像文件大小小于100 KB [英] reduce camera/photo library image file size for less than 100 KB in iphone

查看:406
本文介绍了在iphone中减少相机/照片库图像文件大小小于100 KB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想减少从 UIImagePickerController 获取的图像文件大小。我使用这种方法

I want to reduce image file size that take from UIImagePickerController . I use this method


NSData * imageData = UIImageJPEGRepresentation(image,0.1);

NSData *imageData = UIImageJPEGRepresentation(image, 0.1);

但它将2.2 MB图像文件大小减少到300 KB
我希望我的图像文件大小小于100 KB。

but it reduce 2.2 MB image file size to 300 KB I want my image file size become less than 100 KB.

推荐答案

以千克为单位缩小图像大小的最简单方法是减小像素大小!将其缩小:

Easiest way to reduce image size in kilos is to reduce the size in pixels! Scale it smaller:

CGFloat scaleSize = 0.2f;
UIImage *smallImage = [UIImage imageWithCGImage:image.CGImage
                      scale:scaleSize
                      orientation:image.imageOrientation];

这篇关于在iphone中减少相机/照片库图像文件大小小于100 KB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆