exiftool:删除 exif 数据但保留一些特定标签

Sun*_*ony 10 unix exif command-line exiftool macos

目前我使用带有-all=选项的exiftool,它会从我的照片中删除所有 EXIF 数据:

exiftool -overwrite_original -all= /Users/andyl/photos/*.jpg
Run Code Online (Sandbox Code Playgroud)

现在我希望 exiftool 删除所有 EXIF 信息,但不删除照片的标题、标题和关键字。

我怎么能做到这一点?

Baa*_*arn 7

如果遇到麻烦,您应该始终查看手册页。

man exiftools
Run Code Online (Sandbox Code Playgroud)

应该是这样的:

--TAG

    Exclude specified tag from extracted information.  Same as the -x
    option.  May also be used following a -tagsFromFile option to
      exclude tags from being copied, or to exclude groups from being
    deleted when deleting all information (ie. "-all= --exif:all"
    deletes all but EXIF information).  But note that this will not
    exclude individual tags from a group delete.  Instead, individual
    tags may be recovered using the -tagsFromFile option (ie. "-all=
    -tagsfromfile @ -artist").  Wildcards are permitted as described
    above for -TAG.
Run Code Online (Sandbox Code Playgroud)

就像是:

exiftool -overwrite_original -all= -tagsFromFile @ -title -caption -keywords /Users/andyl/photos/*.jpg
Run Code Online (Sandbox Code Playgroud)

应该管用。使用 确保标签确实以这种方式命名exif /path/to/file.jpg

命令有什么作用?-all=删除所有标签,-tagsFromFile @从源文件中获取列出的标志,在这种情况下@代表当前文件,(你当然可以在这里用固定文件代替-tagsFromFile pic.jpg)并将它们写入目的地。