我希望直接以 NSData 对象的形式使用 ALAssetsLibrary 和 ALAsset 提取图像。
使用 NSURL 我以下列方式取出图像。
NSURL *referenceURL =newURL;
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:referenceURL resultBlock:^(ALAsset *asset)
{
UIImage *copyOfOriginalImage = [UIImage imageWithCGImage:[[asset defaultRepresentation] fullResolutionImage]];
}
现在这里我们将图像作为UIImage,但是我需要将图像直接作为NSData。
我希望这样做,因为(我已经读过)一旦你在 UIImage 中拍摄图像,那么我们就会丢失图像的所有 EXIF 细节。
这就是我想直接将图像提取为 NSData 的原因,而不是这样做
NSData *webUploadData=UIImageJPEGRepresentation(copyOfOriginalImage, 0.5);
这一步让我失去了所有的 EXIF 细节。
请帮忙。