Hello,
My digital camera has no GPS, so I sometimes take pictures with my smartphone when I need to get geotagged pics.
Problem is, I noticed the time on the camera on my last trip was about 1h ahead than the time on the smartphone which is correct since set from the GSM network.
So, to make it easier to create a slideshow, I need to write a Python script to update the file time on all the pics that were taken with the camera, and substract 1h so they're about the right time.
Pseudo-code:
Would someone have some code to share?
Thank you.
---
Edit: Almost there:
My digital camera has no GPS, so I sometimes take pictures with my smartphone when I need to get geotagged pics.
Problem is, I noticed the time on the camera on my last trip was about 1h ahead than the time on the smartphone which is correct since set from the GSM network.
So, to make it easier to create a slideshow, I need to write a Python script to update the file time on all the pics that were taken with the camera, and substract 1h so they're about the right time.
Pseudo-code:
Glog *.jpg including subdirs Read EXIF If no GPX //Camera, not smartphone Substract one hour Update timestamp
Would someone have some code to share?
Thank you.
---
Edit: Almost there:
#pip install pathlib from pathlib import Path #pip install exifread import exifread, sys for mypath in Path('c:/my/path/').rglob('*.jpg'): p = Path(mypath) p = p.resolve() with open(p, 'rb') as f: tags = exifread.process_file(f) if "GPS GPSLatitude" in tags: print("GPS: ", p) else: print("NO GPS")