CGImageProperties.h
lists a bunch of keys to specify EXIF and IPTC metadata. And I can successfully set EXIF metadata for JPEG images:
- (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;
}
However, I'm missing how to specify XMP metadata, specifically the XMP.GPano keys. I tried a dictionary like this:
@{@"XMP": @{@"GPano": @{@"PosePitchDegrees": @20}}}
but it is simply ignored. Is this even possible using Core Graphics?