Here is the script I am Using Python 3:
from print import print
from PIL import Image
import piexif
codec = 'ISO-8859-1' # or latin-1
def exif_to_tag(exif_dict):
exif_tag_dict = {}
thumbnail = exif_dict.pop('thumbnail')
exif_tag_dict['thumbnail'] = thumbnail.decode(codec)
for ifd in exif_dict:
exif_tag_dict[ifd] = {}
for tag in exif_dict[ifd]:
try:
element = exif_dict[ifd][tag].decode(codec)
except AttributeError:
element = exif_dict[ifd][tag]
exif_tag_dict[ifd][piexif.TAGS[ifd][tag]["name"]] = element
return exif_tag_dict
def main():
filename = 'subb.jpeg' # obviously one of your own pictures
im = Image.open(filename)
exif_dict = piexif.load(im.info.get('exif'))
exif_dict = exif_to_tag(exif_dict)
pprint(exif_dict['GPS'])
if __name__ == '__main__':
main()e here
Output is:
{'GPSDateStamp': '2022:09:04',
'GPSLatitude': ((43, 1), (35, 1), (28845, 1277)),
'GPSLatitudeRef': 'N',
'GPSLongitude': ((13, 1), (12, 1), (30645, 1024)),
'GPSLongitudeRef': 'E'}