如何通过ALAssert获取相册原图

1、前提你要确定ALAssert中带的是图片(因为也可能是视频)

[asset valueForProperty:ALAssetPropertyType] == ALAssetTypePhoto

2、获取原图:

- (UIImage *)getImage:(ALAsset *)asset {
     ALAssetRepresentation *representation = [asset defaultRepresentation];
     CGImageRef resolutionRef = [representation fullResolutionImage];
     UIImage *image = [UIImage imageWithCGImage:resolutionRef scale:1.0f orientation:(UIImageOrientation)representation.orientation];
     return image;
}

 

发表评论

您的电子邮箱地址不会被公开。