diff --git a/ldm/simplet2i.py b/ldm/simplet2i.py index 8aad3557af..e592e34f83 100644 --- a/ldm/simplet2i.py +++ b/ldm/simplet2i.py @@ -545,7 +545,9 @@ class T2I: return model def _load_img(self, path): - image = Image.open(path).convert('RGB') + with Image.open(path) as img: + image = img.convert("RGB") + w, h = image.size print(f'loaded input image of size ({w}, {h}) from {path}') w, h = map(