From 145b990c738ff1d84db006e709043b87543d7e19 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 3 Jul 2023 22:47:29 -0400 Subject: [PATCH] thumbnail creation exception handling --- DIFFUSERS.md | 2 +- modules/ui_extra_networks.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/DIFFUSERS.md b/DIFFUSERS.md index d11ce2c42..a0ade1913 100644 --- a/DIFFUSERS.md +++ b/DIFFUSERS.md @@ -73,7 +73,7 @@ will need to handle in the code before we get out of alpha ## Issues -- TBD +- seed vs batch size? ## Notes for HF diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index abd0cd80b..cfb4e7525 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -133,12 +133,15 @@ class ExtraNetworksPage: fn = f'{fn}.thumb.jpg' if os.path.exists(fn): continue - created += 1 - img = Image.open(f) - img = img.convert('RGB') - img.thumbnail((512, 512), Image.HAMMING) - img.save(fn) - img.close() + try: + img = Image.open(f) + img = img.convert('RGB') + img.thumbnail((512, 512), Image.HAMMING) + img.save(fn) + img.close() + created += 1 + except Exception as e: + shared.log.error(f'Extra network error creating thumbnail: {f} {e}') if len(self.missing_thumbs) > 0: shared.log.info(f"Extra network created thumbnails: {self.name} {created}") self.missing_thumbs.clear()