如何在iOS中设置XMP图像元数据?

前端之家收集整理的这篇文章主要介绍了如何在iOS中设置XMP图像元数据?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
CG ImageProperties.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,(__bridge CFDictionaryRef) Metadata);
    CGImageDestinationFinalize(destination);
    CFRelease(source);
    CFRelease(destination);
    return imageData;
}

但是,我想知道如何指定XMP元数据,特别是XMP.GPano键.我试过这样的字典:

@{@"XMP": @{@"GPano": @{@"PosePitchDegrees": @20}}}

但它完全被忽略了.这甚至可以使用Core Graphics吗?

解决方法

您可以使用XMP SDK.它是一个强大的跨平台解决方案(实际上由Apple内部使用).

猜你在找的iOS相关文章