74 lines
2.6 KiB
Python
74 lines
2.6 KiB
Python
|
import os
|
||
|
from datetime import datetime, date, timedelta
|
||
|
from exif import Image
|
||
|
|
||
|
def main():
|
||
|
folder_path = 'C:/Users/arno/Documents/Fotos'
|
||
|
# img_filename = '_DSC9548.JPG'
|
||
|
# img_path = f'{folder_path}/{img_filename}'
|
||
|
|
||
|
# Get the list of image files in the directory that exifread supports
|
||
|
directory = os.listdir(folder_path)
|
||
|
|
||
|
for files in directory:
|
||
|
if files.endswith (('jpg','JPG','png','PNG','tiff','TIFF')):
|
||
|
file_path = os.path.join(folder_path, files)
|
||
|
print (file_path)
|
||
|
img_file = open(file_path, 'rb')
|
||
|
img: Image = Image(img_file)
|
||
|
if img.has_exif:
|
||
|
info = f" has the EXIF {img.exif_version}"
|
||
|
else:
|
||
|
info = "does not contain any EXIF information"
|
||
|
print(f"Image {img_file.name}: {info}")
|
||
|
|
||
|
# Original datetime that image was taken (photographed)
|
||
|
# print(f'DateTime (Original): {img.get("datetime_original")}')
|
||
|
datetime_original = img.get("datetime_original")
|
||
|
# print(datetime_original)
|
||
|
# Grab the date
|
||
|
date_obj = datetime.strptime(datetime_original, '%Y:%m:%d %H:%M:%S')
|
||
|
# print(date_obj)
|
||
|
|
||
|
|
||
|
|
||
|
# with open(img_path, 'rb') as img_file:
|
||
|
# img = Image(img_file)
|
||
|
# if img.has_exif:
|
||
|
# info = f" has the EXIF {img.exif_version}"
|
||
|
# else:
|
||
|
# info = "does not contain any EXIF information"
|
||
|
# print(f"Image {img_file.name}: {info}")
|
||
|
|
||
|
|
||
|
|
||
|
# print(img.list_all())
|
||
|
# print(img.has_exif)
|
||
|
# # Make of device which captured image: NIKON CORPORATION
|
||
|
# print(f'Make: {img.get("make")}')
|
||
|
|
||
|
# # Model of device: NIKON D7000
|
||
|
# print(f'Model: {img.get("model")}')
|
||
|
|
||
|
# # Software involved in uploading and digitizing image: Ver.1.04
|
||
|
# print(f'Software: {img.get("software")}')
|
||
|
|
||
|
# # Name of photographer who took the image: not defined
|
||
|
# print(f'Artist: {img.get("artist")}')
|
||
|
|
||
|
# # Original datetime that image was taken (photographed)
|
||
|
# print(f'DateTime (Original): {img.get("datetime_original")}')
|
||
|
|
||
|
# # Details of flash function
|
||
|
# print(f'Flash Details: {img.get("flash")}')
|
||
|
|
||
|
# print(f"Coordinates - Image")
|
||
|
# print("---------------------")
|
||
|
# print(f"Latitude: {img.copyright} {img.get('gps_latitude_ref')}")
|
||
|
# print(f"Longitude: {img.get('gps_longitude')} {img.get('gps_longitude_ref')}\n")
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
# load_dotenv(find_dotenv())
|
||
|
# print('sensors: {}'.format(os.environ.get(
|
||
|
# 'GLASFASER_GSCHLIEFGRABEN_SENSORS', [])))
|
||
|
main()
|