我用iPhone 4S拍了一张照片,现在用iPhoto查看把照片导入到Mac机器上,假如说这张照片的大小是4.5M。
现在程序需要从iPhone设备上获取这样照片,照片肯定是在相机胶卷这个相册里的。
我通过ALAssetsLibrary一系列的操作获取到了这样照片对应的ALAssets对象,然后用
ALAssetRepresentation *ref = [asset defaultRepresentation];
UIImage* fullimage = [UIImage imageWithCGImage:[ref fullResolutionImage] \
                                                 scale:[ref scale] \
                                           orientation:(UIImageOrientation)[ref orientation]];
得到了图像对象,但是这样通过fullResolutionImage得到的照片比原来的照片大很多,几乎一倍。我查看了一下,iPhoto导出照片的颜色采样是4:2:2,而通过fullResolutionImage得到的颜色采样是4:4:4。
我可以通过UIImageJPEGRepresentation对图像进行压缩,但是这样压缩比是多少才合适呢?其实我只想得到4S拍出来的这样原始照片,跟iPhoto导出来的一样的那张照片。请问该怎么去做呢?