【问题标题】:How to set XMP image metadata in iOS?如何在 iOS 中设置 XMP 图像元数据?
【发布时间】: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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-14
    • 1970-01-01
    • 2013-10-09
    • 1970-01-01
    • 2017-07-26
    • 1970-01-01
    • 1970-01-01
    • 2012-09-10
    相关资源
    最近更新 更多