import gi gi.require_version('GExiv2', '0.10') from gi.repository import GExiv2 if not GExiv2.initialize(): raise RuntimeError("GExiv2 couldn't be initialized") #exif = GExiv2.Metadata("space.jpg") exif = GExiv2.Metadata() exif.open_path("bmw_rim_full.jpg") #exif.open_path("space.jpg") print("*** *** *** *** *** *** ***") print(exif.get_tag_string('Exif.Photo.DateTimeOriginal')) print ("*** *** *** *** *** *** ***") # longitude, latitude, altitude #exif.set_gps_info(-79.3969702721, 43.6295057244, 76) # Using dict notation like this reads/writes RAW string values # into the EXIF data, with no modification/interpolation by GExiv2. # Refer to GExiv2.py to see what kind of convenience methods are # supplied for setting/getting non-string values. #IPTC = 'Iptc.Application2.' #exif[IPTC + 'City'] = 'Toronto' #exif[IPTC + 'ProvinceState'] = 'Ontario' #exif[IPTC + 'CountryName'] = 'Canada' #exif.save_file()