From time to time I find I need to edit the date taken metadata on pictures. I’ve discovered that jhead is a wonderful tool to accomplish this. It has many options, but the ones I use most frequently are the following:
- –mkexif Create EXIF data for a picture that does not contain it
- -ft Set picture’s filesystem modified date to match the EXIF date taken contained in the picture
- –dsft Set the EXIF date taken date of the picture to match the modified time of the filesystem for that picture
You can use wildcards, which is super convenient. To create metadata for all JPG files in a current directory:
jhead -mkexif *.JPG
I like to use touch in conjunction with jhead to set exif picture taken times for files that don’t have any metadata but I know the date they were taken:
jhead -mkexif *.jpg touch -t 201410201700 *.jpg jhead -dsft *.jpg
For pictures which have correct metadata but incorrect modified date (downloaded pictures, for example) simply do the following:
jhead -ft *.jpg
I came across this helpful article which outlines how to view exif information from the command line using the identify command. It requires that imagemagick be installed.
identify -verbose *.jpg | grep "exif:"
This is the syntax I use to set the time of the picture to a specific date:
jhead -tsYYYY:MM:DD-HH:mm:ss <filename>