简体   繁体   English

将 IPTC Core 数据从 JPG 复制到 PNG 文件(具有相同的文件名,批量)

[英]Copy IPTC Core data from JPG to PNG files (with the same filename, in batch)

I like to copy...我喜欢复制...

  • IPTC Core Title IPTC 核心标题
  • IPTC Core Headline IPTC 核心标题
  • IPTC Core Keywords IPTC核心关键词

in a folder of JPG EPS and PNG files with the same filename, from JPGs to PNGs running a command in Exiftool which would do it in batch.在具有相同文件名的 JPG EPS 和 PNG 文件的文件夹中,从 JPG 到 PNG,在 Exiftool 中运行一个命令,该命令将批量执行。

Edit: The filenames contain a "."编辑:文件名包含“。” character, and sometimes a long dash "—"字符,有时还有长破折号“—”

The basic command would be基本命令是
exiftool -ext png -TagsFromFile %d%f.jpg -Title -XMP:Headline -Subject -Description /path/to/PNGS/

You don't mention the OS, but the long dash may cause problems under Windows as CMD/PS have problems with unicode characters, at least in regards to exiftool.你没有提到操作系统,但长破折号可能会在 Windows 下导致问题,因为 CMD/PS 有 unicode 字符问题,至少在 exiftool 方面。 See exiftool FAQ #18 and this StackOverflow answer for workarounds.有关变通方法,请参阅exiftool FAQ #18此 StackOverflow 答案

The -ext ( -extension ) option is used to limit processing to PNG files so you don't waste time copying the jpg data back into the jpg. -ext ( -extension ) 选项用于限制对 PNG 文件的处理,这样您就不会浪费时间将 jpg 数据复制回 jpg。

This command will copy the XMP-dc:Title , XMP-photoshop:Headline , XMP-dc:Description , and XMP-dc:Subject tags (of which the last holds "Keywords") from the jpg file to the png file in the same directory that has the same base name.此命令会将XMP-dc:TitleXMP-photoshop:HeadlineXMP-dc:DescriptionXMP-dc:Subject标签(其中最后一个包含“关键字”)从 jpg 文件复制到 png 文件中具有相同基本名称的相同目录。 The Title and Subject tags have a preferred location in the XMP group so the names can be kept simple but since Headline can be in the IPTC IIM/Legacy group as well as XMP, it needs a leading group name to make sure it's copied to the correct location. TitleSubject标签在 XMP 组中有一个首选位置,因此名称可以保持简单,但由于Headline可以在 IPTC IIM/Legacy 组以及 XMP 中,因此需要一个前导组名称以确保将其复制到正确的位置。

To expand this command to add additional IPTC Core/Ext tags, look for the appropriate tag name on the exiftool XMP tags page , prefix the tag name with -XMP: , and add it to the command someplace after -TagsFromFile %d%f.jpg .要扩展此命令以添加其他 IPTC Core/Ext 标签,请在exiftool XMP 标签页面上查找适当的标签名称,在标签名称前加上-XMP: ,并将其添加到命令中-TagsFromFile %d%f.jpg之后的-TagsFromFile %d%f.jpg The addition of -XMP: may not be necessary for many tags, as not all XMP tags have tags with the same name in other groups.添加-XMP:对于许多标签来说可能不是必需的,因为并非所有 XMP 标签在其他组中都具有相同名称的标签。

There is the possibility, depending upon the app you are using to look at the data, that some of the data may show up as IPTC Core/Ext, but may be located in the IPTC IIM/Legacy or EXIF groups.根据您用于查看数据的应用程序,有可能某些数据可能显示为 IPTC Core/Ext,但可能位于 IPTC IIM/Legacy 或 EXIF 组中。 This is because many apps will display data collected from the corresponding tags in other groups.这是因为许多应用程序会显示从其他组中的相应标签收集的数据。 The above command will not copy data from those other groups to the corresponding IPTC Core/Ext tags, as that is a more complex operation.上述命令不会将这些其他组的数据复制到相应的 IPTC Core/Ext 标签,因为这是一个更复杂的操作。

This command creates backup files.此命令创建备份文件。 Add-overwrite_original to suppress the creation of backup files.添加-overwrite_original以禁止创建备份文件。 Add -r to recurse into subdirectories.添加-r以递归到子目录。

One final detail to take note of is that metadata support in PNG files is very limited in most apps.最后要注意的一个细节是,大多数应用程序对 PNG 文件中的元数据支持非常有限。 While exiftool will copy this data correctly, your app of choice may not display it in a PNG.虽然 exiftool 会正确复制这些数据,但您选择的应用程序可能不会以 PNG 格式显示它。 Windows, for example, will not show any of the above data in the Properties->Details window.例如,Windows 不会在“属性”->“详细信息”窗口中显示任何上述数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM