我正在寻找能否弄清楚如何从我的iphone捕获的图像中访问Exif元数据信息。苹果文档似乎缺乏我正在寻找的必要信息。我可能会愚蠢地谈论这个问题,但我对iPhone编程和目标c相对较新,所以我仍然在想办法。
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
//EXPERIMENTATION
NSDictionary *metadata = [info objectForKey:UIImagePickerControllerMediaMetadata];
NSArray *metaDataKeys = [metadata allKeys];
for (NSUInteger i=0; i [metaDataKeys count]; i++)
{
NSLog(@"%@", [metaDataKeys objectAtIndex:i]);
}
此代码产生以下输出:
2010-10-21 14:42:56.354 _ [3607:307] DPIHeight
2010-10-21 14:42:56.355 _ [3607:307] {Exif}
2010-10-21 14:42:56.356 _ [3607:307] DPIWidth
2010-10-21 14:42:56.357 _ [3607:307]方向
2010-10-21 14:42:56.358 _ [3607:307] {TIFF}
'{Exif}'表示什么?密钥字面上是字符串“{Exif}”吗?我猜不是因为当我尝试用该键提取该对象时,我收到一个NULL。当我最终从这个NSDictionary获得它时,是否有人碰巧知道Exif标签的类型是什么?是否有任何文档有助于学习如何使用Exif标记?谢谢!
答案 0 :(得分:3)
EXIF =可交换图像文件格式
答案 1 :(得分:1)
您可以直接记录词典:
NSLog(@"metadata : %@", metadata);
比单独列出键更简单(也更好),并且还显示其内容!
Metadata {
ColorModel = RGB;
DPIHeight = 72;
DPIWidth = 72;
Depth = 8;
Orientation = 6;
PixelHeight = 55;
PixelWidth = 116;
"{Exif}" = {
ColorSpace = 1;
ComponentsConfiguration = (
1,
2,
3,
0
);
ExifVersion = (
2,
2,
1
);
FlashPixVersion = (
1,
0
);
PixelXDimension = 55;
PixelYDimension = 116;
SceneCaptureType = 0;
};
"{TIFF}" = {
Orientation = 6;
ResolutionUnit = 2;
XResolution = 72;
YResolution = 72;
"_YCbCrPositioning" = 1;
};
}