diff options
author | w-e-w <40751091+w-e-w@users.noreply.github.com> | 2023-08-19 07:50:43 +0000 |
---|---|---|
committer | w-e-w <40751091+w-e-w@users.noreply.github.com> | 2023-08-19 07:50:43 +0000 |
commit | 8ce613bb3af2dcdbabe460a0665f80757ffd9796 (patch) | |
tree | a4e16b4444e65eddee9eb0c806dc9c4ecc08d3bb | |
parent | 9d2299ed0bd6c81cae8a7ba4ca22d6a14fb27bef (diff) | |
download | stable-diffusion-webui-gfx803-8ce613bb3af2dcdbabe460a0665f80757ffd9796.tar.gz stable-diffusion-webui-gfx803-8ce613bb3af2dcdbabe460a0665f80757ffd9796.tar.bz2 stable-diffusion-webui-gfx803-8ce613bb3af2dcdbabe460a0665f80757ffd9796.zip |
switch to PNG when images too large
-rw-r--r-- | modules/images.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/images.py b/modules/images.py index a6b4fb1e..eb644733 100644 --- a/modules/images.py +++ b/modules/images.py @@ -600,6 +600,11 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i """
namegen = FilenameGenerator(p, seed, prompt, image)
+ # WebP and JPG formats have maximum dimension limits of 16383 and 65535 respectively. switch to PNG which has a much higher limit
+ if (image.height > 65535 or image.width > 65535) and extension.lower() in ("jpg", "jpeg") or (image.height > 16383 or image.width > 16383) and extension.lower() == "webp":
+ print('Image dimensions too large; saving as PNG')
+ extension = ".png"
+
if save_to_dirs is None:
save_to_dirs = (grid and opts.grid_save_to_dirs) or (not grid and opts.save_to_dirs and not no_prompt)
|