最好的方法是使用 ALAsset thumbnail。如果您对图像清晰度有疑问,请使用 ALAsset fullResolutionImage
在开始开发照片应用程序之前,您必须阅读以下一些详细信息。
ALAssetsLibrary的一个实例提供对照片应用程序控制下的视频和照片的访问。
ALAsset对象表示由Photo 应用程序管理的照片或视频。
有不同的 ALAsset访问表示
1.缩略图
返回资产的缩略图表示。
- (CGImageRef)thumbnail
2.aspectRatio缩略图
返回资产的纵横比缩略图。
- (CGImageRef)aspectRatioThumbnail
3.defaultRepresentation
返回默认表示的资产表示对象。
- (ALAssetRepresentation *)defaultRepresentation
4.representationForUTI:
返回给定表示 UTI 的资产表示对象。
- (ALAssetRepresentation *)representationForUTI:(NSString *)representationUTI
ALAssetRepresentation对象封装了给定 ALAsset 对象的表示之一。
1.CGImageWithOptions:
返回表示的全分辨率 CGImage。
- (CGImageRef)CGImageWithOptions:(NSDictionary *)options
2.fullResolutionImage
返回资产的 CGImage 表示。
- (CGImageRef)fullResolutionImage
3.全屏图像
返回适合全屏显示的表示的 CGImage。
- (CGImageRef)fullScreenImage
示例代码