From 7a1bbf99da7c9bad866a50890221e4e539e1025d Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Wed, 24 May 2023 16:41:22 -0400 Subject: [PATCH 1/2] Cleaner image metadata read --- modules/images.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/images.py b/modules/images.py index 4e8cd9934..d1801355e 100644 --- a/modules/images.py +++ b/modules/images.py @@ -665,9 +665,13 @@ def read_info_from_image(image): items['exif comment'] = exif_comment geninfo = exif_comment - for field in ['jfif', 'jfif_version', 'jfif_unit', 'jfif_density', 'dpi', 'exif', - 'loop', 'background', 'timestamp', 'duration']: + for field in ['jfif', 'jfif_version', 'jfif_unit', 'jfif_density', 'dpi', 'exif', + 'loop', 'background', 'timestamp', 'duration', 'progressive', 'progression', + 'icc_profile', 'chromaticity']: + try: items.pop(field, None) + except KeyError: + pass if items.get("Software", None) == "NovelAI": try: From 60062b51d821411e8830f321a39ee473431c4535 Mon Sep 17 00:00:00 2001 From: catboxanon <122327233+catboxanon@users.noreply.github.com> Date: Thu, 25 May 2023 08:33:40 -0400 Subject: [PATCH 2/2] Remove try/except in img metadata read --- modules/images.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/images.py b/modules/images.py index d1801355e..93252f417 100644 --- a/modules/images.py +++ b/modules/images.py @@ -668,10 +668,7 @@ def read_info_from_image(image): for field in ['jfif', 'jfif_version', 'jfif_unit', 'jfif_density', 'dpi', 'exif', 'loop', 'background', 'timestamp', 'duration', 'progressive', 'progression', 'icc_profile', 'chromaticity']: - try: - items.pop(field, None) - except KeyError: - pass + items.pop(field, None) if items.get("Software", None) == "NovelAI": try: