我正在使用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;
};
}

最佳答案

请注意,kCGImagePropertyMakerCanonDictionarykCGImagePropertyExifAuxDictionarykCGImagePropertyTIFFDictionary不是CGImageSourceCopyPropertiesAtIndex可以理解的选项。它们是返回字典的键。它似乎并没有引起任何问题,但是它也无济于事。

我没有看到声明的属性键来访问图片样式数据,但是无论如何它似乎确实是由CGImageSourceCopyPropertiesAtIndex返回的。如果丢弃props字典,则应该看到{PictureStyle}密钥,其中包含带有感兴趣信息的字典。您还将看到{MakerCanon}密钥。这对应于常量kCGImagePropertyMakerCanonDictionary,并且该词典中的属性是relevant section of the documentation中描述的属性。

关于ios - 从元数据中提取图像图片样式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15474524/

10-11 02:43
查看更多