diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-08-23 22:08:59 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-08-23 22:08:59 +0000 |
commit | 165da39fb1a2ad89eb5b13429e7664d9ec8fd29f (patch) | |
tree | 8dc7cce85c911020278f1044818ee6903f4a7f92 /webui.py | |
parent | 81087207bc62026a3e6941553bf98f2da8c799d0 (diff) | |
download | stable-diffusion-webui-gfx803-165da39fb1a2ad89eb5b13429e7664d9ec8fd29f.tar.gz stable-diffusion-webui-gfx803-165da39fb1a2ad89eb5b13429e7664d9ec8fd29f.tar.bz2 stable-diffusion-webui-gfx803-165da39fb1a2ad89eb5b13429e7664d9ec8fd29f.zip |
fixed a possible issue with older versions of PIL
Diffstat (limited to 'webui.py')
-rw-r--r-- | webui.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -34,6 +34,7 @@ mimetypes.add_type('application/javascript', '.js') opt_C = 4
opt_f = 8
+LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS)
invalid_filename_chars = '<>:"/\|?*\n'
parser = argparse.ArgumentParser()
@@ -490,7 +491,7 @@ def img2img(prompt: str, init_img, ddim_steps: int, use_GFPGAN: bool, prompt_mat def init():
image = init_img.convert("RGB")
- image = image.resize((width, height), resample=Image.Resampling.LANCZOS)
+ image = image.resize((width, height), resample=LANCZOS)
image = np.array(image).astype(np.float32) / 255.0
image = image[None].transpose(0, 3, 1, 2)
image = torch.from_numpy(image)
|