Merge pull request #7691 from missionfloyd/16bit-convert

Convert 16-bit greyscale to 8-bit when saving as JPEG
This commit is contained in:
AUTOMATIC1111 2023-02-19 10:15:49 +03:00 committed by GitHub
commit 9c4eaac61f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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("RGB" if extension.lower() == ".webp" else "L")
image_to_save.save(temp_file_path, format=image_format, quality=opts.jpeg_quality)