thumbnail creation exception handling

pull/1582/head
Vladimir Mandic 2023-07-03 22:47:29 -04:00
parent 8374f08de8
commit 145b990c73
2 changed files with 10 additions and 7 deletions

View File

@ -73,7 +73,7 @@ will need to handle in the code before we get out of alpha
## Issues ## Issues
- TBD - seed vs batch size?
## Notes for HF ## Notes for HF

View File

@ -133,12 +133,15 @@ class ExtraNetworksPage:
fn = f'{fn}.thumb.jpg' fn = f'{fn}.thumb.jpg'
if os.path.exists(fn): if os.path.exists(fn):
continue continue
created += 1 try:
img = Image.open(f) img = Image.open(f)
img = img.convert('RGB') img = img.convert('RGB')
img.thumbnail((512, 512), Image.HAMMING) img.thumbnail((512, 512), Image.HAMMING)
img.save(fn) img.save(fn)
img.close() 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: if len(self.missing_thumbs) > 0:
shared.log.info(f"Extra network created thumbnails: {self.name} {created}") shared.log.info(f"Extra network created thumbnails: {self.name} {created}")
self.missing_thumbs.clear() self.missing_thumbs.clear()