1
在ALAssetRepresentation中解释XMP元数据
当用户对iOS上内置的Photos.app中的照片进行某些更改(裁剪,消除红眼,...)时,更改不会应用于fullResolutionImage相应的ALAssetRepresentation。 然而,这些变化应用到thumbnail与fullScreenImage被返回ALAssetRepresentation。此外,可以ALAssetRepresentation通过键在的元数据字典中找到有关已应用更改的信息@"AdjustmentXMP"。 我想将这些更改应用于fullResolutionImage自己,以保持一致性。我发现,在iOS6 +上 CIFilter,filterArrayFromSerializedXMP: inputImageExtent:error:可以将此XMP元数据转换为的数组CIFilter: ALAssetRepresentation *rep; NSString *xmpString = rep.metadata[@"AdjustmentXMP"]; NSData *xmpData = [xmpString dataUsingEncoding:NSUTF8StringEncoding]; CIImage *image = [CIImage imageWithCGImage:rep.fullResolutionImage]; NSError *error = nil; NSArray *filterArray = [CIFilter filterArrayFromSerializedXMP:xmpData inputImageExtent:image.extent error:&error]; if (error) { NSLog(@"Error during CIFilter creation: %@", [error localizedDescription]); } CIContext *context = [CIContext contextWithOptions:nil]; for …