Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#7691 from missionfloyd/16bit-convert
Browse files Browse the repository at this point in the history
Convert 16-bit greyscale to 8-bit when saving as JPEG
  • Loading branch information
AUTOMATIC1111 authored Feb 19, 2023
2 parents 2a4f893 + 02e5256 commit 9c4eaac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ def _atomically_save_image(image_to_save, filename_without_extension, extension)
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)

Expand Down

0 comments on commit 9c4eaac

Please sign in to comment.