1

我需要从选定的资产中获取exif信息并在屏幕上显示其中的一部分。

4

2 回答 2

10
[[asset defaultRepresentation] metadata];

返回给定资产表示的元数据字典的字典。查看此字典以获取您感兴趣的数据。我不确定,但我认为该字典(和子字典)中的键与CGImageProperties Reference下列出的键相同。

于 2011-12-12T14:23:18.883 回答
0

这是一个完整的答案......都在一个地方

NSDictionary *nsd = [[asset3 defaultRepresentation] metadata];
    NSString *widthStr = [nsd objectForKey: @"PixelWidth"];
    NSString *heightStr = [nsd objectForKey: @"PixelHeight"];

    NSLog(@"nsd: %@ ... widthStr: %@ ... heightStr: %@ ...", nsd, widthStr, heightStr);

输出:

nsd: {
    ColorModel = RGB;
    DPIHeight = 72;
    DPIWidth = 72;
    Depth = 8;
    Orientation = 1;
    PixelHeight = 1136;
    PixelWidth = 642;
    "{Exif}" =     {
        ColorSpace = 1;
        ComponentsConfiguration =         (
            1,
            2,
            3,
            0
        );
        ExifVersion =         (
            2,
            2,
            1
        );
        FlashPixVersion =         (
            1,
            0
        );
        PixelXDimension = 642;
        PixelYDimension = 1136;
        SceneCaptureType = 0;
    };
    "{TIFF}" =     {
        Orientation = 1;
        ResolutionUnit = 2;
        XResolution = 72;
        YResolution = 72;
    };
} ... widthStr: 642 ... heightStr: 1136 ...
于 2014-03-04T01:39:20.230 回答