如何使用 exiftool 将元数据从源图像批量复制到目标图像? [英] How to batch copy metadata from source images to target images with 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:All C:photo
此命令将处理 C:photo
中的文件,检查以确保 _compressed
在名称中,并从文件中复制所有相同的标签name 从文件的基本名称末尾减去 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 Common错误 #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屋!