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

标签 ios core-graphics metadata exif xmp

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 吗?

最佳答案

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

关于ios - 如何在 iOS 中设置 XMP 图像元数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37522317/

相关文章:

ios - scrollViewDidScroll 没有被调用(我设置了委托(delegate)!)

amazon-web-services - AWS CloudFormation - Ubuntu Nginx 元数据

ios - 如何通过swift3在firebase中24小时内删除数据

ios - 在 NSUserDefaults 中存储图像以在 tableView 中显示它们时出现问题。 swift

ios - SWRevealViewController 传递参数

C# 从元数据中获取视频文件持续时间

php - 如何使用 PHP 从 JPEG 中获取 'title' 和 'tags' exif 数据

ios - 在 iOS 中绘制全屏线性渐变的最快方法

iphone - 流畅的 iPhone 动画《植物大战僵尸》

iphone - iPhone游戏中的简单菜单