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吗?
答案 0 :(得分:0)
您可以使用XMP SDK。它是一个强大的跨平台解决方案(实际上由Apple内部使用)。