The EXIFTool is incredibly useful for dealing with tags in image files, but one of those tools that I use only once every six months or so. Then when I try to use it again I’ve forgotten even the simplest commands. There are also a lot of scripting features built into ExifTool (more than most Unix style, do-only-one-thing, tools) meaning you can often achieve what you want without having to wrap it in other commands or a Bash script.
The bare command just lists all the existing tags found in an image file.
By default this will hide some duplicate entries, or group very similar entries. Using the
-a tag shows all entries, and avoids the automatic suppression of tags that are duplicated between tags of the same name.
If you want to see a specific tag, then add it to the command, but it’s not important to match the spaces or capitalisation. E.g. if there is a tag “GPS Date/Time”, you could display it with
exiftool -gpsdatetime mypicture.jpg
If you need a custom output format, you can use the
-p for Print Format and use tag names as a variable within a string, e.g.
exiftool -p 'This image was taken at $gpsdatetime' mypicture.jpg
To deal with multiple pictures you can either point ExifTool at a directory instead of a single file. The
-r will run the command recursively, and process any images it finds in sub-directories. e.g. the following will work on all pictures in the Pictures directory, and below.
exiftool -r -gpsdatetime ~/Pictures
If you want to filter files based on their type/extension then use the
-ext flag and choose your extension. This is not case sensitive, but it will differentiate between “.jpg” and “.jpeg” should you have both in your collection.
exiftool -gpsdatetime -ext jpg ~/Pictures
Generally editing tags is in the format
-tagname='new tag value', the single quotes are only needed if your new value has spaces in it.
To delete a tag, and its value, just leave a blank after the equals sign, e.g.
There is also a special “all” tag, which is most useful if you want to remove any metadata from an image, e.g. the following would remove all metadata from all jpg files in the directory “Pictures”.
exiftool -all= -ext jpg ~/Pictures
The default behaviour of ExifTool when editing is to create a copy of the original, but with “_original” added to the end after the file extension. This only works once, and keeps the original from the first time. e.g. If you make two changes to myimage.jpg, the _original version will always be the one saved before the first change, it’s not tracking the original minus the last change.
If you want to modify the original (which is hopefully already a copy) then use the
-overwrite_original flag. I generally don’t, I’m happy for it to create the back ups, then I can double-check the results, and afterwards always delete all the originals if I want with a quick
Some tags, like “Keywords” are a list. These behave slightly differently to other tags. Here you have to either list the entries separately, as follows:
exiftool -keywords=banana -keywords=fruit myimage.jpg
or use the
-sep flag to do it in one entry.
exiftool -sep ", " -keywords="banana, fruit" myimage.jpg
If all you want to do is add or remove specific items you can use the
You can combine removing all tags with the tags from file feature, e.g. to remove all the tags except the Create Date (creation timestamp), do the following, which specifies to keep the EXIF based Create Date tag, and delete all others. The @ sign below is a short-cut for the source file, so really what’s happening is it’s deleting all the tags, and then copying one back from the original.
exiftool -all= -tagsfromfile @ -exif:createdate myimage.jpg
In most cases the tag I’m adding is to add copyright info into the image, from the examples above this is pretty easy, once you know which tags you want to add.
The IPTC Organisation recommends the following minimum metadata from their useful userguide page.
- Description/Caption: Description of picture
- Creator/Image Creator: “the name of the photographer, but in cases where the photographer should not be identified the name of a company or organisation may be appropriate.”
- Copyright Owner: The person or entity that owns the copyright. In most amateur cases that’s your name.
- Copyright Notice: “Contains any necessary copyright notice for claiming the intellectual property for artwork or an object in the image and should identify the current owner of the copyright of this work with associated intellectual property rights.” .e.g.“©2021 Henry Leach, All Rights Reserved”
- Credit line: “the credit to person(s) and/or organisation(s) required by the supplier of the image to be used when published.” e.g. “©2021 Henry Leach: henryleach.com”
- Create Date: Can normally be from the EXIF Data, which I’m pretty sure is the tag “Create Date” not “Date Created” as listed on the IPCT’s website. I assume most viewing software renames this tag for display.
exiftool -creator='Henry Leach' \ -copyrightowner='Henry Leach' \ -copyrightnotice='(c)2021 Henry Leach, All Rights Reserved' \ -creditline='(c)2021 Henry Leach: henryleach.com' \ myimage.jpg
\ allows the continuation of the command on a new line, and makes no functional difference. Make sure to leave a space between the last command on a line and the
\, otherwise it will be interpreted as one command, the
\ is completely invisible.)
It would be nicer to use the © symbol instead of “(c)” in the copyright lines, but I couldn’t get this to work reliably, possibly as some tags like EXIF only support ASCII characters, which don’t include the © symbol.
This is the most common use for me, so combining all of the above into one command we get:
exiftool -all= \ -tagsfromfile @ -exif:createdate \ -creator='Henry Leach' \ -copyrightowner='Henry Leach' \ -copyrightnotice='(c)2021 Henry Leach All Rights Reserved' \ -creditline='(c)2021 Henry Leach: henryleach.com' \ myimage.jpg
The ExifTool site as many great common examples for most of the common things you want to do with it.