菜鸟教程小白 发表于 2022-12-12 09:46:13

ios - 从元数据中提取图像图片样式


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

<p>我主要是缺少“图片样式”和“佳能”信息。</p>

<p>我是如何读取元数据的:</p>

<pre><code>NSURL *imageFileURL = ;
CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)CFBridgingRetain(imageFileURL), NULL);
CFDictionaryRef props = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
NSLog(@&#34;%@&#34;, props);
</code></pre>

<p>谁有提示?</p>

<p>这是使用预览的信息</p>

<p> <img src="/image/qCU7f.png" alt="enter image description here"/> </p>

<p>这是来自 NSLog 的信息:</p>

<pre><code>2013-04-02 09:50:06.885 i2 {
ColorModel = RGB;
DPIHeight = 72;
DPIWidth = 72;
Depth = 8;
Orientation = 1;
PixelHeight = 1728;
PixelWidth = 2592;
&#34;{Exif}&#34; =   {
    ApertureValue = &#34;5.375&#34;;
    BodySerialNumber = 1280809746;
    ColorSpace = 1;
    ComponentsConfiguration =         (
      1,
      2,
      3,
      0
    );
    CustomRendered = 0;
    DateTimeDigitized = &#34;2012:12:24 12:58:46&#34;;
    DateTimeOriginal = &#34;2012:12:24 12:58:46&#34;;
    ExifVersion =         (
      2,
      3
    );
    ExposureBiasValue = 0;
    ExposureMode = 1;
    ExposureProgram = 1;
    ExposureTime = &#34;0.003125&#34;;
    FNumber = &#34;6.3&#34;;
    Flash = 16;
    FlashPixVersion =         (
      1,
      0
    );
    FocalLength = 22;
    FocalPlaneResolutionUnit = 2;
    FocalPlaneXResolution = &#34;2857.773&#34;;
    FocalPlaneYResolution = &#34;2904.202&#34;;
    ISOSpeedRatings =         (
      3200
    );
    LensModel = &#34;EF-S10-22mm f/3.5-4.5 USM&#34;;
    LensSpecification =         (
      10,
      22,
      0,
      0
    );
    MeteringMode = 5;
    PixelXDimension = 2592;
    PixelYDimension = 1728;
    SceneCaptureType = 0;
    ShutterSpeedValue = &#34;8.375&#34;;
    SubsecTime = 35;
    SubsecTimeDigitized = 35;
    SubsecTimeOriginal = 35;
    WhiteBalance = 1;
};
&#34;{IPTC}&#34; =   {
    StarRating = 0;
};
&#34;{TIFF}&#34; =   {
    DateTime = &#34;2012:12:24 12:58:46&#34;;
    Make = Canon;
    Model = &#34;Canon EOS 7D&#34;;
    Orientation = 1;
    ResolutionUnit = 2;
    XResolution = 72;
    YResolution = 72;
    &#34;_YCbCrPositioning&#34; = 2;
};
}
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>请注意,<code>kCGImagePropertyMakerCanonDictionary</code>、<code>kCGImagePropertyExifAuxDictionary</code> 和 <code>kCGImagePropertyTIFFDictionary</code> 不是 <code>CGImageSourceCopyPropertiesAtIndex</code> 可以理解的选项。它们是它返回的字典中的键。通过它们似乎不会导致任何问题,但它也没有实现任何目标。</p>

<p>没有声明的属性键来访问我可以看到的图片样式数据,但它似乎是由 <code>CGImageSourceCopyPropertiesAtIndex</code> 返回的。如果您转储 <code>props</code> 字典,您应该会看到一个 <code>{PictureStyle}</code> 键,其中包含包含感兴趣信息的字典。您还会看到 <code>{MakerCanon}</code> 键。这对应于常量<code>kCGImagePropertyMakerCanonDictionary</code>,并且该字典中的属性在<a href="http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CGImageProperties_Reference/Reference/reference.html#//apple_ref/doc/constant_group/Canon_Camera_Dictionary_Keys" rel="noreferrer noopener nofollow">relevant section of the documentation</a> 中描述。 .</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 从元数据中提取图像图片样式,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/15474524/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/15474524/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 从元数据中提取图像图片样式