“{Exif}”是什么意思?从 [NSArray objectAtIndex:] 指示

发布于 2024-09-28 16:35:12 字数 1055 浏览 3 评论 0原文

我正在寻找是否可以弄清楚如何从我的 iPhone 捕获的图像中访问 Exif 元数据信息。苹果文档似乎缺乏我正在寻找的必要信息。我可能会愚蠢地处理这个问题,但我对 iPhone 编程和 Objective-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] DPI宽度
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 标签?谢谢!

I'm on a quest to see if I can figure out how to access Exif Metadata information from an image captured by my iphone. The apple documentation seems to lack the necessary information I'm looking for. I'm probably going about this stupidly, but I'm relatively new to iPhone programming and objective-c so I'm still figuring everything out.


- (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]);
}  

This code produces the following output:
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] Orientation
2010-10-21 14:42:56.358 _[3607:307] {TIFF}

What does '{Exif}' indicate? Is the key literally a string "{Exif}"? I'm guessing no because when I try to extract that the object with that key I receive a NULL. And does anyone happen to know what type the Exif tag will be when I eventually get it from this NSDictionary? Is there any documentation anywhere that is helpful for learning how to work with Exif tags? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青衫负雪 2024-10-05 16:35:12

您可以直接记录字典:

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;
    };
}

You can log dictionaries directly:

NSLog(@"metadata : %@", metadata);

which is simpler (and better) than listing the keys like you do, and also shows their contents!

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;
    };
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文