- [Instructor] ExifTool is a free command line program
that can read and modify embedded metadata
and it runs on Windows, Mac OS and Linux.
You can learn more about it
and download the software @exiftool.org.
It's most basic mode operation
is to simply list all the metadata it can find in a file.
Even though it's called ExifTool,
it can read some other types of metadata
from files that it knows about and supports.
Usually though, we'll use it for media files of some type,
images, audio or video.
ExifTool is also a useful program if we're writing scripts
or processing large amounts of files.
We can use it to extract metadata
from a bunch of files at once
or to change values one at a time or in bulk.
This makes it quite helpful
in both information gathering workflows
and file sanitization workflows.
We can think of a variety of scenarios
where this could be handy.
Perhaps we're a photographer and want to set our copyright,
license data and project number
on each of 600 photos we took,
or we might want to strip GPS data
and camera serial number data
from photos we're sending to an art competition
or to share online.
Many services strip sensitive metadata automatically now,
but not all do,
so it's good to know how to do that for ourselves
and it's useful to know
how to add metadata to images as well.
Let's take a look at a photo I took a few years ago
on a trip to Barcelona.
This was taken inside the Mercat De Sant Antoni,
pardon my pronunciation,
and I know that I took this photo with my camera
that doesn't have a built-in GPS feature.
So I'd like to add some GPS metadata to this photo
so it'll show the right location in my photo browser.
Most photo browsers on most platforms
let us do this within their interface,
but they're all different.
So let's use ExifTool,
which works the same way across all platforms
to explore this photo's metadata
and to make the changes we need to.
I'll switch over to my PowerShell terminal here.
And I'll change to the directory where my photo is stored.
Now let's explore the metadata for this file
with a command exiftool
and the name of the file.
This gives us a huge amount of information
from basic information about the file,
like its name, its size, and so on,
to more specific information
like the camera model name,
the software the camera was using,
and details about the exposure time
and other values that the camera wrote into the file.
We can also read only specific values if we want to
using their argument names.
We can find the argument names that apply to a given file
with the -args option.
I'll recall my previous command and add that here,
and I'll run it again.
And here on the left of the specific arguments
that correspond to each of these values.
For example, we can get just the exposure time
and F stop values for a photo like this.
If these values have been written by the camera
or other software,
that's pretty useful
if you're looking for specific information
in a set of files.
But we can also use argument names to set values too.
I mentioned earlier
that this file doesn't have GPS information.
And if I move back to my photo browser
and open the file info,
I can see that there's no map presented.
So let's add some GPS information
with the arguments GPS latitude and GPS longitude.
Those argument names don't appear in the list for this file
because they're not set for this file,
so that can be a little tricky.
The manual pages for ExifTool on Linux and Mac OS
or the ExifTool website
if you don't have manual pages on your OS,
provide a rich source of documentation
and list the arguments available to us.
To add my GPS information,
I'll need those latitude and longitude values,
so I'll pop over to the web
and grab those from a mapping site.
I'll search for the location that the photo was taken,
and here in the URL
I can find the latitude and longitude values
that I'm looking for.
I'll copy those values
and I'll switch back to my terminal.
Using those values, I'll populate two arguments.
All right, exiftool -GPS latitude equals that first value
- GPS longitude equals the second value,
and then the name of my file.
When I ran this command,
ExifTool made a copy of the original
and replaced it with my updated image.
So, let's open that up and take a look at the GPS data.
There's a location right where I expected it to be, great.
Keep in mind though,
we could have just as easily put in
incorrect GPS information
and make it seem as though this photo
were taken at another market anywhere in the world.
Removing metadata is just as important
and we can remove specific values
by setting their arguments to an empty string.
For example, I could remove the GPS information I just added
with exiftool -GPS latitude equals nothing
- GPS longitude equals nothing, and the name of the file.
Now when I open the file again,
I can see that the GPS information is gone
from this newly made copy.
The information is still there in the previous copy
so keeping the copy straight is important
if you're redacting sensitive information.
We can also use ExifTool to extract information from a file
and represent it elsewhere.
For example, I took this photo in 2018,
but the creation date here in the file information
says it was created today.
That's because this actual file was created today
when we changed the GPS information just a moment ago.
So that's correct if you look at it one way,
but it may be the case
that I want to represent this file's creation date
with the actual date that I took the photo,
that's when the photo was created after all.
To do that, I can use the less than symbol
with a metadata argument
to set the file's creation date like this.
All right, exiftool "-filecreatedate<exif:createdate"
and the name of the file.
This has quotes around it,
so the full argument is pass to ExifTool.
This reads the X of create date
into the file create date value.
I'll press return.
And if I switch back to my file browser,
I can see that that value was updated
from the date inside the embedded metadata.
This date value is actually stored in the file system
not the file itself,
and we'll explore how that works in the next chapter.
Files can have a lot of dates associated with them
both internally in their embedded metadata
and on the file system.
The metadata dates vary by file type,
but many photos
will have a variety of creation and modification dates
that can be interesting to explore.
These embedded dates and the file system dates
can be useful for different purposes,
but some of them, especially file system dates,
can be modified when files are copied or edited.
For example, if you're undertaking a project
to scan old family photos and documents,
you might choose to leave the date you scan them
as their regular file system creation date
and store the date information
from when the photos were actually taken
in an embedded field,
which is less likely to be altered
when files are copied or edited.
While ExifTool can be a little bit tricky to learn,
it's an incredible piece of software
and a valuable tool to become familiar with.
I enjoy using it when I work across different platforms
because it shows me the same information in the same place
using the same commands syntax.
It frees me from having to remember
how to use different tools on different platforms.
And keep in mind, it's not only for images.
If you work with metadata,
I encourage you to spend some time exploring it.