Help – Learn how to fix missing location data in jpg/jpeg images (EXIF) using your Location History

Sometimes people take photos without GPS enabled or just in that moment the location isn’t determined by the smartphone, so the photos areen’t tagged with a location. There are multiple possibilities to tag existing photos in order to show them on a map. You can do it manually using the exiftool as example, or you can use your Google Location History (See your Timeline).

If you want to fix a bunch of photos without to much work, the second options is much better, it will save you a lot of time. The requirement is that you had that feature enabled when you took the pictures.

Here are the steps to follow if you want to fix them

  1. Go to Google Takout (Download your data)
  2. Deselect all
  3. Search “Location History” and choose JSON as export format
  4. Click on “Next step”
  5. Click on “Create Archive”
  6. Your archive will be generated and a link will be send to your E-mail address
  7. Extract that archive and put your json file somewhere. As example “C:\Users\denny\Downloads\Location History.json
  8. Save that script below somewhere. As example “C:\Users\denny\Downloads\
  9. Make sure you’ve installed python 3.x

Run the following commands:

python -m pip install pillow piexif
python ""\
".\Google Photos"\
".\Downloads\Location History.json"\
  • python argument: path to your .py file
  • script argument 1: The path to the folder containing your untagged photos
  • script argument 2: The path to your location .json file
  • script argument 3: The path to a folder where the output will be generated

Sample output:

Loading locations...
Locations: 709122
Loading photos...
Photos: 4223
Filtering photos by missing location...
Photos without location: 42
Filtering photos by fixable locations...
Found location for photos C:\Users\denny\Google Drive\Google Photos\2019\20190501_163719.jpg. Hours away: 0.0016988888714048597. In threshold: True
Found location for photos C:\Users\denny\Google Drive\Google Photos\2019\20190524_183505.jpg. Hours away: 0.053024166689978704. In threshold: True
Photos to fix: 42

Process finished with exit code 0

All your tagged photos will be saved as a copy into the output folder. A thrashold of 3 hours is configured to not accidentially tag a photos with a false location.

If you want to re-upload them to Google Photos, please follow these instructions

  1. Delete the original photo from Google Photos
  2. Upload the modified photo
  3. Add that photo to the original album if needed


Get it here.

<span>%d</span> bloggers like this: