2

我正在使用 ios CGImageSourceCopyPropertiesAtIndex 为 ios 上的图像提取大量元数据。但我无法提取所有元数据,如 Mac Preview 应用程序或 exiftool 命令中显示的元数据。

我主要缺少“图片样式”和“佳能”信息。

我如何阅读元数据:

NSURL *imageFileURL = [NSURL fileURLWithPath:filePath];
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)CFBridgingRetain(imageFileURL), NULL);
CFDictionaryRef props = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
NSLog(@"%@", props);

有人有提示吗?

这是使用预览的信息

在此处输入图像描述

这是来自 NSLog 的信息:

2013-04-02 09:50:06.885 i2[67169:1f0f] {
ColorModel = RGB;
DPIHeight = 72;
DPIWidth = 72;
Depth = 8;
Orientation = 1;
PixelHeight = 1728;
PixelWidth = 2592;
"{Exif}" =     {
    ApertureValue = "5.375";
    BodySerialNumber = 1280809746;
    ColorSpace = 1;
    ComponentsConfiguration =         (
        1,
        2,
        3,
        0
    );
    CustomRendered = 0;
    DateTimeDigitized = "2012:12:24 12:58:46";
    DateTimeOriginal = "2012:12:24 12:58:46";
    ExifVersion =         (
        2,
        3
    );
    ExposureBiasValue = 0;
    ExposureMode = 1;
    ExposureProgram = 1;
    ExposureTime = "0.003125";
    FNumber = "6.3";
    Flash = 16;
    FlashPixVersion =         (
        1,
        0
    );
    FocalLength = 22;
    FocalPlaneResolutionUnit = 2;
    FocalPlaneXResolution = "2857.773";
    FocalPlaneYResolution = "2904.202";
    ISOSpeedRatings =         (
        3200
    );
    LensModel = "EF-S10-22mm f/3.5-4.5 USM";
    LensSpecification =         (
        10,
        22,
        0,
        0
    );
    MeteringMode = 5;
    PixelXDimension = 2592;
    PixelYDimension = 1728;
    SceneCaptureType = 0;
    ShutterSpeedValue = "8.375";
    SubsecTime = 35;
    SubsecTimeDigitized = 35;
    SubsecTimeOriginal = 35;
    WhiteBalance = 1;
};
"{IPTC}" =     {
    StarRating = 0;
};
"{TIFF}" =     {
    DateTime = "2012:12:24 12:58:46";
    Make = Canon;
    Model = "Canon EOS 7D";
    Orientation = 1;
    ResolutionUnit = 2;
    XResolution = 72;
    YResolution = 72;
    "_YCbCrPositioning" = 2;
};
}
4

1 回答 1

1

请注意kCGImagePropertyMakerCanonDictionarykCGImagePropertyExifAuxDictionarykCGImagePropertyTIFFDictionary不是可以CGImageSourceCopyPropertiesAtIndex理解的选项。它们是它返回的字典中的键。它似乎不会导致任何问题通过它们,但它也没有实现任何目标。

CGImageSourceCopyPropertiesAtIndex没有声明的属性键可以访问我可以看到的图片样式数据,但无论如何它似乎都返回了。如果您转储props字典,您应该会看到一个{PictureStyle}包含感兴趣信息的字典的键。您还会看到一把{MakerCanon}钥匙。这对应于常量kCGImagePropertyMakerCanonDictionary,并且该字典中的属性是文档相关部分中描述的属性。

于 2013-03-27T10:04:07.350 回答