Extract image size before other exif data (fix focal computation)

pull/1401/head
Piero Toffanin 2022-01-05 18:22:54 +00:00
rodzic d7b986a1b1
commit 3e64c715fe
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -164,6 +164,11 @@ class ODM_Photo:
# Disable exifread log
logging.getLogger('exifread').setLevel(logging.CRITICAL)
try:
self.width, self.height = get_image_size.get_image_size(_path_file)
except Exception as e:
raise PhotoCorruptedException(str(e))
with open(_path_file, 'rb') as f:
tags = exifread.process_file(f, details=False)
try:
@ -358,10 +363,6 @@ class ODM_Photo:
# self.set_attr_from_xmp_tag('bandwidth', tags, [
# 'Camera:WavelengthFWHM'
# ], float)
try:
self.width, self.height = get_image_size.get_image_size(_path_file)
except Exception as e:
raise PhotoCorruptedException(str(e))
# Sanitize band name since we use it in folder paths
self.band_name = re.sub('[^A-Za-z0-9]+', '', self.band_name)