怎么把WIC XMP people标签写成jpg? [英] How to write WIC XMP people tags to jpg?

查看:56
本文介绍了怎么把WIC XMP people标签写成jpg?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有人标记信息的xml图像.我希望编辑此信息,并将其添加到尚无此信息的图片中.通过查看xml,我认为它基于 Microsoft映像组件中使用的人员标记.

I have images with people tagging information in xml format. I wish to edit this information and also add it to pictures that do not yet have it. By looking at the xml I assume it is based on the people tagging used in the microsoft imaging component.

我还不太了解这种格式,但是到目前为止,我仍然可以理解或修改xml,但我不知道在图像中的什么位置.我可能只是在犯一些愚蠢的错误,因为我对这些图像元数据没有经验.因此,如果您认为我走错了路,而且可以简单得多,请告诉我.

I haven't quite understood the format, but I understood it sof far, that I can alter or gemerate the xml, I just do not know where to write it in the image. I am probably just doing some stupid mistake, because I am not experienced with these image metadatas. So if you think I'm just on the wrong track and that can be done much simpler, please tell me.

在那些已经包含此xml的图像中,我可以使用搜索和替换来更新xml.但是,我有很多图片还不包含这些信息,而且我不知道应该将其写入图像的什么位置.

In those images that already contain this xml, I can use search and replace to update the xml. However I have a lot of pictures that do not yet contain that information and I do not know where I should write it to inside the image.

可以使用exiftool读取已经包含此信息的图像,如下所示:

Images that already contain this information can be read with exiftool as follows:

exiftool -xmp -b existingTags.JPG

结果是以下xml:

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP 
Core 4.4.0-Exiv2"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" 
xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" 
xmlns:MP="http://ns.microsoft.com/photo/1.2/" xmlns:MPRI="http://ns.microsoft.com/photo/1.2/t/RegionInfo#" 
xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#" xmp:Rating="0"> <dc:subject> <rdf:Bag> <rdf:li>Valeriya
</rdf:li> </rdf:Bag> </dc:subject> <MP:RegionInfo rdf:parseType="Resource"> <MPRI:Regions> <rdf:Bag> <rdf:li 
MPReg:Rectangle="0.48, 0.418, 0.059333, 0.089" MPReg:PersonDisplayName="findus_l"/> </rdf:Bag> </MPRI:Regions> 
</MP:RegionInfo> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="w"?>

但是我不能使用exiftool编写信息.当我运行此命令时,它只是再次读取信息,而不是将文件内容写入图像:

However I cannot write the information using exiftool. When I ran this command, it simply reads the information again, instead of writing the contents of the file to the image:

exiftool -xmp<=alteredXMP.txt existingTags.JPG

一些研究表明,exiftool只能编写特定的xmp标签,而Windows成像组件中的人员标记标签似乎并不是其中的一部分.

A bit of research has shown me, that exiftool can only write specific xmp tags, and the people tagging tags from windows imaging component do not seem to be part of this.

我应该在图像文件的哪里写信息?我能以某种方式以编程方式找到该位置,然后在其中插入xml吗?

Where in the image file should I write the information? Can I somehow find this spot programmatically and then just insert the xml there?

我使用Kotlin作为编程语言,但我不介意调用命令行功能或其他程序.

I am using Kotlin as programming language but I don't mind having to call command line functions or other programs.

背景:我有一个Synology Diskstation,并使用了随附的名为photo station的软件.Photo Station支持在图像上标记人物并使用此给定格式.我在很多方面都喜欢Photo Station,但是人脸识别能力很差,因此我想使用自己的照片,但是Photo Station能够读取它.

Background: I have a Synology Diskstation and use the included software called photo station. The photo station supports tagging of people on the images and uses this given format. I like the photo station in many ways, but the face recognition is bad, so I want to use my own but have photo station be able to read it.

推荐答案

您要写入的数据是 Microsoft区域结构.XMP结构化数据是复杂的主题,但是您应该能够通过写入区域名称来使用exiftool添加数据标记为 RegionPersonDisplayName 标记,区域尺寸为 RegionRectangle .使用示例中的数据,命令将为:
exiftool -RegionPersonDisplayName = findus_1 -RegionRectangle ="0.48,0.418,0.059333,0.089"/path/to/files

The data you are trying to write is part of the Microsoft Region Structure. XMP Structured data is a complex subject but you should be able to add the data with exiftool by writing region names to the RegionPersonDisplayName tag and the region dimensions to the RegionRectangle. Using the data in your example, the command would be:
exiftool -RegionPersonDisplayName=findus_l -RegionRectangle="0.48, 0.418, 0.059333, 0.089" /path/to/files

如果必须编写多个区域,则可以仅添加它们,但是必须以相同的顺序保留名称和匹配的尺寸.例如
exiftool -RegionPersonDisplayName = findus_1 -RegionRectangle ="0.48,0.418,0.059333,0.089" -RegionPersonDisplayName ="John Smith" -RegionRectangle ="0.37645533,0.04499886,0.35111009,0.26633097"/path/to/files

If you have to write multiple regions, you can just add them on, but you must keep names and the matching dimensions in the same order. For example
exiftool -RegionPersonDisplayName=findus_l -RegionRectangle="0.48, 0.418, 0.059333, 0.089" -RegionPersonDisplayName="John Smith" -RegionRectangle="0.37645533, 0.04499886, 0.35111009, 0.26633097" /path/to/files

这些命令将覆盖任何现有的区域数据.如果要添加新名称而不进行覆盖,则可以将等号更改为PlusEqual + = .

These commands would overwrite any existing region data. If you are adding new names without overwriting, you would change the equal signs to PlusEqual +=.

这篇关于怎么把WIC XMP people标签写成jpg?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆