gpt4 book ai didi

objective-c - 如何读取一张照片元数据中的 "{TIFF}"信息

转载 作者:搜寻专家 更新时间:2023-10-30 19:56:36 25 4
gpt4 key购买 nike

我是 objective-c 的新手,我在读取 UIImagePickerControllerMediaMetaData 中的信息时遇到问题。

-(void) imagePickerController:(UIImagePickerController *)imagepicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

//This line is fine.
NSDictionary *metadata = [info objectForKey:UIImagePickerControllerMediaMetadata];

//This line fail to operate...
NSArray *tiffData = [metadata objectForKey:Exif];

我可以获得元数据。然而,元数据中的信息有点困惑,下面显示了元数据中的内容。

UIImagePickerControllerMediaMetadata =     {
DPIHeight = 72;
DPIWidth = 72;
Orientation = 6;
"{Exif}" = {
ApertureValue = "2.526068811667588";
BrightnessValue = "-1.739497174308802";
ColorSpace = 1;
DateTimeDigitized = "2012:02:21 11:53:44";
DateTimeOriginal = "2012:02:21 11:53:44";
ExposureMode = 0;
ExposureProgram = 2;
ExposureTime = "0.06666666666666667";
FNumber = "2.4";
Flash = 32;
FocalLenIn35mmFilm = 32;
FocalLength = "2.03";
ISOSpeedRatings = (
800
);
MeteringMode = 5;
PixelXDimension = 960;
PixelYDimension = 720;
SceneType = 1;
SensingMethod = 2;
Sharpness = 0;
ShutterSpeedValue = "3.906905022631062";
WhiteBalance = 0;
};
"{TIFF}" = {
DateTime = "2012:02:21 11:53:44";
Make = Apple;
Model = "iPad 2";
Software = "5.0.1";
XResolution = 72;
YResolution = 72;
};
};

那么如何读取“{Exif}”和“{TIFF}”?

谢谢你帮助我。我到处找,只是没能得到答案......

最佳答案

{EXIF}{TIFF} 条目是元数据字典中包含的字典。您可以使用以下代码获取对它们的引用:

NSDictionary *metadata = [info objectForKey:UIImagePickerControllerMediaMetadata];
NSDictionary *exifMetadata = [metadata objectForKey:(id)kCGImagePropertyExifDictionary];
NSDictionary *tiffMetadata = [metadata objectForKey:(id)kCGImagePropertyTiffDictionary];

CGImageProperties Reference 文档页面中描述了所有元数据键。 (id) 转换是必需的,因为所有键都是 CFStringRef,并且需要免费桥接到 NSString

关于objective-c - 如何读取一张照片元数据中的 "{TIFF}"信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9377478/

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