How to Fix GPS Coordinates and Time of a Photo
Context and Problem
During a holiday trip, I received some photos on paper which I wanted to digitize and add to Google Photos. To ensure these pictures are discoverable, I wanted to ensure they have the right GPS coordinates and time.
How should I fix the Exif metadata?
Solution
The following was tested on Ubuntu 22.04.01 LTS.
Install exiftool:
1
sudo apt install libimage-exiftool-perl
Note down the GPS Latitude, GPS Longitude and local time:
1 2 3 4 5
GPS_LAT=48.059457 GPS_LAT_REF=N # N = North, S = South GPS_LON=20.74614 GPS_LON_REF=E # E = East, W = West LOCAL_TIME=2022-07-27T201406 # Prefer ISO 8601
Set the Exif tags:
1 2 3 4 5 6
exiftool 00*.jpg \ -gpslatitude=$GPS_LAT \ -gpslongitude=$GPS_LON \ -gpslatituderef=$GPS_LAT_REF \ -gpslongituderef=$GPS_LON_REF \ -AllDates=$LOCAL_TIME
🎉
Upload to Google Photos and check the result!
Gotchas
- Exif times (
DateTime
,DateTimeOriginal
andDateTimeDigitized
) assume local time. UseGPSDateTime
is you want to store GPS Time, which is timezone-independent.