gpt4 book ai didi

macos - Exiftool在PNG图像中创建OSX可见XMP元数据

转载 作者:行者123 更新时间:2023-12-04 04:41:34 31 4
gpt4 key购买 nike

在我的图像处理软件周围,我使用exiftool成功地重排了Cr2,TIFF和JPG文件中的exif信息。添加的标签(例如“关键字”)都可以在OSX(山狮)Finder,Preview中看到,并可以由Spotlight很好地索引。

对于PNG,我需要回退到XMP,因为这是PNG的元数据容器。但是,添加了exiftool的标签似乎没有被Preview或SpotLight拾取。相反,如果我先在Preview中添加标签,然后再使用exiftool添加新标签,则该索引已被索引。我在XMP原始数据中看到的是这里的区别,其中exiftool新创建了一个 header ,而Preview没有。

作为示例,请在不带元数据https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png的PNG上的Wikipedia页面上查看以下PNG:

使用exiftool添加关键字,然后转储XMP数据块:

exiftool -xmp-dc:subject=ViaExifSubject ./PNG_transparency_demonstration_1.png
exiftool -xmp -b ./PNG_transparency_demonstration_1.png

提供以下XMP数据:
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 9.02'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about=''
xmlns:dc='http://purl.org/dc/elements/1.1/'>
<dc:subject>
<rdf:Bag>
<rdf:li>ViaExifSubject</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='r'?>

但是,在“预览”或Finder信息面板中,找不到“ViaExifSubject”。

或者,使用OSX预览添加注释(在“预览”中打开,显示检查器,转到“关键字”选项卡,单击“+”添加关键字)。 XMP通过exiftool再次转储:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.1.2">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:subject>
<rdf:Bag>
<rdf:li>viaPreview</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>

预览生成的关键字中不存在 xpacket header ,并且XMP Toolkit是不同的。现在可以看到“viaPreview”标签,例如在CLI上使用 mdls

将原始XMP信息推送到一个干净的文件中也不会产生预期的结果:
exiftool "-xmp<=viaexif.xmp" PNG_transparency_demonstration_1.png

出乎意料的是,如果我首先使用Preview创建一个标签,然后执行上面的命令,则新标签会反射(reflect)出来,我怀疑我正在监督一个需要“激活”的外部数据解析器,拾取该标签并将其放在另一个标签中。存储(例如.DS_store)。我还没有看到任何添加的xattr。

这些是我的问题:
  • 是exiftool用于XMP/PNG组合的正确工具,我是否缺少特定功能
  • OSX是否违反XMP标准?编辑:默认默认
  • ,OSX不遵守 apparently XMP
  • 我应该研究替代工具来剥离容器吗?


  • 我在磁盘上挖了xmp_sdk并尝试了提供的示例:

    ModifyXMP可以将“纯” XMP信息写入PNG,这在OSX Finder中显示-这是一个很好的目标。

    尽管OSX Finder中未显示此信息,但ReadingXMP可以读取ExifTool插入到PNG中的XMP信息。

    在查看ModifyXMP的输出并插入完全相同的XMP Blob的exiftool时,文件大小相似。差异显示exiftool附加在文件的末尾,XMP sdk将其放在PNG的 header 中。 XMP spec指出“鼓励编码器将块放置在文件的开头,但这不是必需的。”

    结论:exiftool编写XMP的方式存在(轻微)差异,这特别与OSX的元数据检索混为一谈。

    目前:
  • 尝试使用XMP SDK,在开头插入一个干净的XMP数据包,并让exiftool重用第一个块。
  • I reposted on exiftools' forum,作者Phil Harvey回答:

    I did some playing with Apple Preview, and not only does it not recognize XMP at the end of the file, but also it deletes this XMP when adding keywords to the image. My guess is that Apple software ignores XMP if it comes after the IDAT chunk. It would have been wonderful if the XMP specification had mandated that the XMP chunk come before IDAT, but it didn't, so this must be considered a bug in the Apple software. I have added this to the list of Known problems.



    最后,Phil Harvey决定在Exiftool本身中解决此问题:

    I have done a lot of work on this, and Exiftool 9.40 will have a new option to allow you to write XMP before the PNG IDAT chunk. The corresponding command will look like this: exiftool -api PNGEarlyXMP ...

  • 向Apple提交了一个错误-2014年12月更新:Apple关闭了我的错误,指出他们将对此主题不采取任何措施
  • 最佳答案

  • 您可以尝试XMP Toolkit SDK及其示例,并为PNG编写元数据。
  • OSX使用IPTC(不确定,请在某处阅读),并且XMP工具箱确实协调XMP和IPTC,因此使用XMP Toolkit添加的关键字将在OS X上可搜索。

    从您的观察看来,exiftool无法协调IPTC和XMP。您可以尝试在PNG中尝试同时更改IPTC和XMP,然后查看它是否可搜索。

  • 关于macos - Exiftool在PNG图像中创建OSX可见XMP元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19154596/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com