diff --git a/ldm/data/data_loader.py b/ldm/data/data_loader.py index c11b413..72257da 100644 --- a/ldm/data/data_loader.py +++ b/ldm/data/data_loader.py @@ -69,7 +69,14 @@ class DataLoaderMultiAspect(): #if debug_level > 1: print(f" * DLMA file: {pathname} with caption: {caption}") - image = Image.open(pathname) + try: + image = Image.open(pathname).convert('RGB') + except Exception as e: + print(f"File corrupt. Cannot continue. Error opening image: {self.pathname}") + print(e) + print(f"You should remove this image or try to correct it by resaving it.") + exit() + width, height = image.size image_aspect = width / height