Skip to content

Instantly share code, notes, and snippets.

@fusionfox
Last active July 7, 2022 03:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fusionfox/fcaf97eafcfc7ebef3edd3f8eb8f0c5c to your computer and use it in GitHub Desktop.
Save fusionfox/fcaf97eafcfc7ebef3edd3f8eb8f0c5c to your computer and use it in GitHub Desktop.
ExifTool geotagging script
#!/bin/bash
# Check to see if arguments were supplied
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
then
echo -e "Usage:\ngeotag.sh LAT LON FILES"
exit
fi
# Store Latitude and Longitude, removing them from params list
LAT=$1
shift
LON=$1
shift
# Create array of files to geotag from remaining params
FILES=($@)
TOTAL=0
# Add geotag to each file
for FILE in "${FILES[@]}"
do
exiftool -preserve -overwrite_original -gpslatitude="$LAT" -gpslatituderef="$LAT" -gpslongitude="$LON" -gpslongituderef="$LON" "$FILE"
((TOTAL++))
done
echo "Total: $TOTAL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment