aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormissionfloyd <missionfloyd@users.noreply.github.com>2023-02-09 09:13:49 +0000
committermissionfloyd <missionfloyd@users.noreply.github.com>2023-02-09 09:13:49 +0000
commit463ab841803b45ea421ad7f9769b836f3000ef8c (patch)
treeb97c8585c6f16ca73911d0309eff684c6d5961ed
parentea9bd9fc7409109adcd61b897abc2c8881161256 (diff)
downloadstable-diffusion-webui-gfx803-463ab841803b45ea421ad7f9769b836f3000ef8c.tar.gz
stable-diffusion-webui-gfx803-463ab841803b45ea421ad7f9769b836f3000ef8c.tar.bz2
stable-diffusion-webui-gfx803-463ab841803b45ea421ad7f9769b836f3000ef8c.zip
Convert 16-bit greyscale to 8-bit when saving as JPEG
-rw-r--r--modules/images.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/images.py b/modules/images.py
index c2ca8849..c0c68913 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -553,6 +553,8 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
elif extension.lower() in (".jpg", ".jpeg", ".webp"):
if image_to_save.mode == 'RGBA':
image_to_save = image_to_save.convert("RGB")
+ elif image_to_save.mode == 'I;16':
+ image_to_save = image_to_save.point(lambda p: p * 0.0038910505836576).convert("L")
image_to_save.save(temp_file_path, format=image_format, quality=opts.jpeg_quality)