From 5129f256a3ef4c702ba96ffebba55368abaea63e Mon Sep 17 00:00:00 2001 From: yun saki Date: Fri, 26 Aug 2022 14:13:16 +0200 Subject: [PATCH] simplet2i: changed image file handling to work as stated in the [docs](https://pillow.readthedocs.io/en/stable/reference/open_files.html) --- ldm/simplet2i.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(