Last active
July 7, 2022 03:31
-
-
Save fusionfox/fcaf97eafcfc7ebef3edd3f8eb8f0c5c to your computer and use it in GitHub Desktop.
ExifTool geotagging script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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