Manipulate EXIF data with exiftool

Sometimes your pictures miss EXIF data or you need to manipulate the data. We have a delicious web gallery were I often post pictures from various sources. The latest post to date is some drone footage from our farm. Our gallery extracts and sort pictures by the exif ''DateTimeOriginal'' tag. These pictures are just frames from a movie and have limited metadata, so I wanted to copy from the EXIF's ''FileModifyDate'' to ''DateTimeOriginal''.

For one file this can be done with

exiftool '-DateTimeOriginal<FileModifyDate' nice_biceps.jpg;

And for multiple

for file in $(ls *.jpg); do exiftool '-DateTimeOriginal<FileModifyDate' $file; done

If by some reason you do not have ''FileModifyDate'', you will get a ''warning: no writable tags set from…''. You can list all available tags from your file with

exiftool -s nice_biceps.jpg

The -s gives you the actual tag and not just the description.

You can also override //all// date tags with i.e. the filename if the filename is a unix timestamp, which I hade to do in this album containing one year1(!) of webcam pictures.

for file in $(ls | grep jpg$); do unix=$(echo $file | cut -d'.' -f1) newdate=$(date "+%Y:%m:%d %H:%M:%S" -d @$unix) exiftool -AllDates="$newdate" -overwrite_original $file done

A list of all EXIF tags can be found here