gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 06:13:45 29 4
gpt4 key购买 nike

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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com