【发布时间】:2016-05-30 09:35:21
【问题描述】:
CGImageProperties.h 列出了一组键来指定 EXIF 和 IPTC 元数据。我可以成功地为 JPEG 图像设置 EXIF 元数据:
- (NSData*)imageDataForImage:(UIImage*)image {
NSDictionary *metadata = @{kCGImagePropertyExifDictionary: @{(NSString*)kCGImagePropertyExifLensModel: @"my lens"}};
NSData* rawImageData = UIImageJPEGRepresentation(image, 1.0f);
NSMutableData *imageData = [NSMutableData data];
CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef) rawImageData, NULL);
CGImageDestinationRef destination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, kUTTypeJPEG, 1, NULL);
CGImageDestinationAddImageFromSource(destination, source, 0, (__bridge CFDictionaryRef) metadata);
CGImageDestinationFinalize(destination);
CFRelease(source);
CFRelease(destination);
return imageData;
}
但是,我缺少如何指定 XMP 元数据,特别是 XMP.GPano 键。我试过这样的字典:
@{@"XMP": @{@"GPano": @{@"PosePitchDegrees": @20}}}
但它只是被忽略了。这甚至可以使用 Core Graphics 实现吗?
【问题讨论】:
-
您好,我也遇到了同样的问题,您是否能够找到解决方案,或者使用图像目的地根本不可能?
标签: ios core-graphics metadata exif xmp