Skip to content

Instantly share code, notes, and snippets.

@feklee
Last active January 10, 2024 08:52
Show Gist options
  • Save feklee/2e386d0988fb9dbb6698c25968bcc8af to your computer and use it in GitHub Desktop.
Save feklee/2e386d0988fb9dbb6698c25968bcc8af to your computer and use it in GitHub Desktop.
Geotags image files
#!/bin/bash
# Felix E. Klee <[email protected]>
if [ $# -ne 2 ]; then
cat <<EOF
Usage: $0 GPSDIR DIR
Geotags image files in DIR using GPS tracks stored in GPSDIR. The
tags are added in Exif data. Files that already are geotagged are not
tagged again.
EOF
exit 1
fi
GPSDIR=$1
DIR=$2
# Only tags files that were not already tagged by checking if
# `gpslatitude` is set, see:
# https://exiftool.org/forum/index.php?topic=15559.msg83566
exiftool -if 'not $gpslatitude' -geotag "$GPSDIR/*" \
-q -q \
-progress \
-recurse \
-overwrite_original \
-ext jpg -ext jpef -ext tif -ext arw -ext nef -ext sr2 -ext dng \
"$DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment