从iOS照片库中获取图片数据

时间:2022-03-19 21:19:10

I need to get metadata (EXIF and other) from images stored in the iOS photo gallery. Therefore I need the original picture data instead of an UIImage object.

我需要从iOS照片库中存储的图像中获取元数据(EXIF和其他)。因此我需要原始图片数据而不是UIImage对象。

At the moment I get the asset-image url using imagepickercontroll and ALAssetsLibrary as described here: display image from URL retrieved from ALAsset in iPhone

目前我使用imagepickercontroll和ALAssetsLibrary获取资产图像网址,如下所述:从iPhone中的ALAsset检索到的URL显示图像

This url can be used to get an UIImage object but how can I get the original image so that I can process it's metadata?

这个url可用于获取UIImage对象,但是如何获取原始图像以便我可以处理它的元数据?

Regards,

问候,

1 个解决方案

#1


1  

ALAssetsLibrary to retrieve all images here

ALAssetsLibrary在此处检索所有图像

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:assetURL
resultBlock:^(ALAsset *asset)  {
    NSDictionary *metadata = asset.defaultRepresentation.metadata;
    imageMetadata = [[NSMutableDictionary alloc] initWithDictionary:metadata];
    [self addEntriesFromDictionary:metadata];
}
failureBlock:^(NSError *error) {
}];
[library autorelease];

Refer more getting-metadata-from-images-on-ios link and get helped.

请参阅更多从元数据获取元数据到ios链接并获得帮助。

#1


1  

ALAssetsLibrary to retrieve all images here

ALAssetsLibrary在此处检索所有图像

ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:assetURL
resultBlock:^(ALAsset *asset)  {
    NSDictionary *metadata = asset.defaultRepresentation.metadata;
    imageMetadata = [[NSMutableDictionary alloc] initWithDictionary:metadata];
    [self addEntriesFromDictionary:metadata];
}
failureBlock:^(NSError *error) {
}];
[library autorelease];

Refer more getting-metadata-from-images-on-ios link and get helped.

请参阅更多从元数据获取元数据到ios链接并获得帮助。