如何使用exiftool将元数据从源图像批量复制到目标图像? [英] How to batch copy metadata from source images to target images with exiftool?

查看:62
本文介绍了如何使用exiftool将元数据从源图像批量复制到目标图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图像位于C:/photo的文件夹中.

The images are located in folders inside C:/photo.

我在其子文件夹及其内部都有原始图像和压缩图像.

I have original images and compressed images inside its subfolders and itself.

以下是图像的组织方式示例:

Here is a example of how the images are organized:

C:/photo/photo1.jpg
C:/photo/photo1_compressed.jpg
C:/photo/folder1/photo2.jpg
C:/photo/folder1/photo2_compressed.jpg
C:/photo/folder1/photo3.jpg
C:/photo/folder1/photo3_compressed.jpg
C:/photo/folder2/photo4.jpg
C:/photo/folder2/photo4_compressed.jpg
C:/photo/folder2/folder3/photo5.jpg
C:/photo/folder2/folder3/photo5_compressed.jpg

后缀为 _compressed 的图像是具有相同名称但没有后缀的原始图像的压缩版本.

Images with suffix _compressed are compressed version of original images with the same name but without the suffix.

如何使用exiftool将元数据从原始图像递归复制到压缩的副本中?只复制一个标签或几个选定的标签怎么办?

How could I use exiftool to copy the metadata from original images to its compressed counterpart, recursively? What about just copying just one tag or a couple of selected tags?

推荐答案

您的命令将是:
exiftool -if" $ Filename =〜/_compressed/i"-r -TagsFromFile%d%-.11f.%e -All:全部C:\ photo

此命令将处理 C:\ photo 中的文件,检查以确保名称中包含 _compressed ,并使用相同的名称复制文件中的所有标签名称从文件基名的末尾减去11个字符.

This command will process the files in C:\photo, check to make sure that _compressed is in the name, and copy all tags from the file with the same name minus 11 characters from the end of the file's basename.

由于要递归,因此不能使用通配符仅处理压缩文件(请参见 Exiftool常见错误#2 -r ( -recurse )选项).

Because you want to recurse, you cannot use a wildcard to only process the compressed files (see Exiftool Common Mistake #2 and the -r (-recurse) option).

如果您只想复制特定标签,则将 -All:All 替换为 -TAG1 -TAG2 -TAGn ,用实际标签名称替换 TAG#.

If you want to only copy specific tags, you would replace -All:All with -TAG1 -TAG2-TAGn, replacing TAG# with the actual tag names.

此命令将不会复制某些标签,例如 ICC_Profile .您可以通过在 -TagsFromFile 选项之后添加 -ColorSpaceTags 来复制与颜色相关的标签.

This command will not copy some tags like ICC_Profile. You can copy color related tags by adding -ColorSpaceTags after the -TagsFromFile option.

此命令创建备份文件.添加 -overwrite_original 以禁止创建备份文件.如果此命令在Unix/Mac上运行,请对任何双引号/单引号进行反向处理,以避免bash解释.

This command creates backup files. Add -overwrite_original to suppress the creation of backup files. If this command is run under Unix/Mac, reverse any double/single quotes to avoid bash interpretation.

这篇关于如何使用exiftool将元数据从源图像批量复制到目标图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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