This is a brief guide to using ExifTool to geotag a folder of images.
- On OSX: get ExifTool with Homebrew:
brew install exiftool
- Ubuntu/Mint:
sudo apt install exiftool
- On Windows: download from the ExifTool website. Replace exiftool with exiftool.exe in the examples here!
Example:
exiftool -overwrite_original -r -geotag TRACK.gpx PHOTOS/
This will take the GPX file TRACK.gpx
and apply the interpolated GPS positions for the timestamps found in all image files to each image in the directory PHOTOS and all its subdirectories. It will result in a set of images with a new set of EXIF tags: GPS position and height, and some GPS metadata.
Note: -overwrite_original is faster on the Mac than -overwrite_original_in_place. Testing a 300MB directory (20 JPG) gave:
# -overwrite_original:
real 0m3.637s
user 0m1.744s
sys 0m0.891s
# -overwrite_original_in_place:
real 0m4.043s
user 0m1.725s
sys 0m1.569s
Tool options:
- -overwrite_original # delete the original file
- -geotag TRACK.gpx # use TRACK.gpx with capture time to geotag
- -r # recursively dig down into subfolders
- PHOTOS/ # geotag all photos in this and subfolders
Having the camera facing down on the strut confuses the position sensor, and images end up being rotated randomly. To remove rotation from an image:
exiftool -Orientation=1 EXAMPLE.jpg
Overwriting images takes a long time, so I decided to try geotagging and erasing orientation directly from the SD card and then immediately writing the result to the storage drive. Copying from SD was taking a long time already, and this doesn't seem to add appreciably to the initial copy step while removing any later postprocessing needed.
exiftool -Orientation=1 -geotag TRACKLOG.gpx -o OUTPUTDIRECTORY/ -r INPUTDIRECTORY/
- If the times don't overlap, exiftool will IGNORE files, leaving them in the original location! Best to back that command up with an rsync to catch any ignored files - i.e.
rsync -av --modify-window=2 --ignore-existing INPUTDIRECTORY/ OUTPUTDIRECTORY/