Read and Safely Edit Image Metadata with ExifTool

ExifTool will happily rewrite your photos, so learn to do it with a rollback copy before you need one. This workflow inspects an image, changes one metadata tag, keeps a backup and verifies the result. Allow about fifteen minutes, plus time to work out which tags your camera or application actually uses.

The examples use ExifTool 12.76 from the Debian package libimage-exiftool-perl, version 12.76+dfsg-1.

1. Check the installed command

Confirm the executable and version before relying on a tag or option. This is read-only:

$ command -v exiftool
/usr/bin/exiftool
$ exiftool -ver
12.76
$ dpkg-query -W -f='${Package} ${Version}\n' libimage-exiftool-perl
libimage-exiftool-perl 12.76+dfsg-1

Checkpoint: if your version differs, read that installation's manual page before copying examples into automation. ExifTool supports many formats, but a format can be readable without being writable.

2. Inspect before changing anything

Start with a narrow query and quote the path. Replace the placeholder with a real file; the command prints the tags that exist:

$ exiftool -ImageWidth -ImageHeight -FileType -MIMEType /path/to/IMAGE.jpg
Image Width                    : 248
Image Height                   : 87
File Type                      : PNG
MIME Type                      : image/png

Those values are an example from the installed command, not a promise about your file.

Warning: if you omit tag options, ExifTool tries to print all available metadata. That can include device identifiers, GPS coordinates, filenames and software details, so do not paste unrestricted output into public tickets.

Use -s when you want stable tag names rather than friendly descriptions:

$ exiftool -s -FileName -FileType /path/to/IMAGE.jpg
FileName                        : IMAGE.jpg
FileType                        : JPEG

Directories are the classic trap. ExifTool processes the supported files directly inside a directory and does not descend into subdirectories unless you add -r. Even with -r, directories whose names begin with a dot are skipped. Check the file list first instead of assuming a recursive command touched everything.

3. Make one reversible metadata edit

Writing uses -TAG=VALUE. This example sets a comment on one image:

$ exiftool -Comment='Reviewed for catalogue' /path/to/IMAGE.jpg
    1 image files updated

By default, ExifTool keeps the previous file with _original appended to its name. Verify both the new value and the backup:

$ exiftool -s -Comment /path/to/IMAGE.jpg
Comment                        : Reviewed for catalogue
$ ls -l /path/to/IMAGE.jpg /path/to/IMAGE.jpg_original
-rw-r--r-- 1 user group ... /path/to/IMAGE.jpg
-rw-r--r-- 1 user group ... /path/to/IMAGE.jpg_original

Output formatting and permissions vary. Three things matter:

Warning: -overwrite_original removes that safety copy by renaming the temporary result over the original. Use it only after you have a separate backup and have verified the workflow. It is not a general speed switch.

4. Undo or delete a tag deliberately

To restore the pre-edit file, stop using the edited file and put the _original copy back with a file operation that suits your backup policy. A simple same-directory example:

$ mv /path/to/IMAGE.jpg /path/to/IMAGE.jpg.edited
$ mv /path/to/IMAGE.jpg_original /path/to/IMAGE.jpg
$ exiftool -s -Comment /path/to/IMAGE.jpg

Warning: check the paths with ls before running those moves. They change names and can overwrite an existing destination, so do not use them blindly in a batch job.

To delete just the tag, assign an empty value. The automatic backup still applies:

$ exiftool -Comment= /path/to/IMAGE.jpg
    1 image files updated
$ exiftool -s -Comment /path/to/IMAGE.jpg
Warning: Tag 'Comment' is not defined

The exact warning depends on the file and the output options you chose. For a stronger check, query the tag and inspect the exit status:

$ exiftool -s -Comment /path/to/IMAGE.jpg
$ printf 'exit status: %s\n' "$?"
exit status: 0

Deleting one tag is not the same as removing all metadata. A command such as -all= wipes the metadata, so treat it as a separate, backed-up operation.

5. Copy selected metadata between files

Use -tagsFromFile when a destination should inherit metadata from another file. Copy only the tags you mean to transfer:

$ exiftool -tagsFromFile /path/to/SOURCE.jpg -Artist -Copyright /path/to/DESTINATION.jpg
    1 image files updated
$ exiftool -s -Artist -Copyright /path/to/DESTINATION.jpg
Artist                          : Example Studio
Copyright                       : Example Studio 2026

The destination gets its own _original backup.

Warning: a bare -tagsFromFile SOURCE DESTINATION copies all writable tags, which may include more personal or location information than you expected. Name the source and destination explicitly, and query the destination afterwards.

Group names can matter. If a tag exists in more than one metadata group, specify the group, such as -XMP:City=Example, instead of relying on the preferred group. Run exiftool -listg to see the group names on this installation.

6. Keep bulk operations controlled

Before a directory operation, do a dry inspection with a narrow tag query. Add -ext jpg or another extension when the directory holds unrelated files:

$ exiftool -FileName -FileType -ext jpg /path/to/photos
/path/to/photos/one.jpg
File Name                       : one.jpg
File Type                       : JPEG

Add the write operation only after checking the listed scope. Remember that -r includes subdirectories, and that hidden files are processed when they sit directly inside a named directory. For a first run, work on a copied directory and keep the generated _original files until you have checked every result.

ExifTool exits with status 0 on success, 1 when an error occurred, and 2 when all files failed an -if condition. Scripts should check that status rather than searching human-readable output. ExifTool handles Ctrl-C so that critical writes are completed or cleaned up, but that is no reason to skip backups.

Done means