Tuesday, December 9, 2014
ExifTool by Phil Harvey is a fantastic tool to edit the exif metadata on your pictures. It is especially useful when you have a lot of pictures to edit and have no desire to change metadata by hand.
This post will be an ever growing list of useful exiftool commands and scripts.
You can quickly figure out if a picture is missing a particular exif property by running the following command. In this example, I want to see if my picture has the DateTimeOriginal exif property set:
exiftool -filename -r -if '(not $datetimeoriginal)' /path/to/picture.jpg
If you have a folder of pictures to check, or even a folder contaning even more folders of pictures, you can simply replace /path/to/picture.jpg with /path/to/picture/directory/:
exiftool -filename -r -if '(not $datetimeoriginal)' /path/to/picture/directory/
The picture does not have the DateTimeOriginal exif property if its file name is returned.
Ryan M provides more insight into finding and fixing images with no exif dates.
If your picture was taken on June 29, 2007 at 1:38:55 PM, you can add the CreateDate exif property to your picture with the following command:
exiftool -createdate="2007:06:19 13:38:55" /path/to/picture.jpg
I had a situation where many of my pictures did not have the CreateDate exif property but they did have the DateTimeOriginal exif property. I wanted the CreateDate exif property to have the same value as the DateTimeOriginal exif property. ExifTool’s if functionality makes this easy to fix:
exiftool '-createdate<datetimeoriginal' -r -if '(not $createdate and $datetimeoriginal)' /path/to/picture/directory/
ExifTool will always copy the original picture and then make its modifications. If you want it to overwrite the original picture, add
-overwrite_original_in_place to the exiftool command line.