- add TextObservation format for pechgraben fotos
This commit is contained in:
parent
edfff8bd84
commit
1b7cfa1586
4 changed files with 335 additions and 24 deletions
|
@ -1,47 +1,52 @@
|
|||
'''
|
||||
Sqlalchemy version: 1.2.15
|
||||
Python version: 3.7
|
||||
'''
|
||||
|
||||
import os
|
||||
from datetime import datetime, date, timedelta
|
||||
from datetime import datetime
|
||||
from exif import Image
|
||||
|
||||
|
||||
def main():
|
||||
folder_path = 'C:/Users/arno/Documents/Fotos'
|
||||
''' main method '''
|
||||
folder_path = 'C:/Users/kaiarn/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')):
|
||||
if files.endswith(('jpg', 'JPG', 'png', 'PNG', 'tiff', 'TIFF')):
|
||||
file_path = os.path.join(folder_path, files)
|
||||
print (file_path)
|
||||
# print(file_path)
|
||||
img_file = open(file_path, 'rb')
|
||||
img: Image = Image(img_file)
|
||||
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"
|
||||
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)
|
||||
|
||||
date_obj = datetime.strptime(
|
||||
datetime_original, '%Y:%m:%d %H:%M:%S')
|
||||
print(date_obj)
|
||||
# print(f"Longitude: {img.get('gps_longitude')} {img.get('gps_longitude_ref')}\n")
|
||||
|
||||
|
||||
# with open(img_path, 'rb') as img_file:
|
||||
# img = Image(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
|
||||
|
@ -50,7 +55,7 @@ def main():
|
|||
# # Model of device: NIKON D7000
|
||||
# print(f'Model: {img.get("model")}')
|
||||
|
||||
# # Software involved in uploading and digitizing image: Ver.1.04
|
||||
# # 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
|
||||
|
@ -61,14 +66,13 @@ def main():
|
|||
|
||||
# # 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()
|
||||
main()
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue