【发布时间】:2014-02-20 02:15:14
【问题描述】:
我要做的是从 ALAsset(图像)获取 NSData,磁盘上图像的大小是 75 KB,但是当我试图从该资产中获取 NSData 时,它返回的 NSData 大小非常大,我的问题是“如何从图像中返回 75KB 的数据而不是更大的尺寸”
我的代码:
ALAssetRepresentation* representation = [asset defaultRepresentation];
CGFloat scale = 1;
UIImage* image = [UIImage imageWithCGImage:[representation fullResolutionImage]
scale:scale orientation:orientation];
NSData *data = UIImagePNGRepresentation(image);
【问题讨论】:
-
也许您想要 JPEG 表示而不是 PNG。
-
你是怎么得到这 75KB 的?
标签: ios iphone objective-c