-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not convert to JPEG if not possible #7616
Conversation
Do not export for 4chan if conversion to JPEG is not possible. This prevents an exception when trying to save large depthmaps when export_for_4chan setting is on
May I ask, what is this "Export for 4chan" thing? |
@Nacurutu It is an UI setting. If enabled, export every large/heavy image as a shrunk/smaller JPG. The setting has a "4MB" in its wording in the UI (sorry, I am not near a computer rn). |
thank you! |
stable-diffusion-webui/modules/images.py Lines 553 to 555 in c429bcc
You could convert 16-bit to 8-bit before saving, like so: 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") |
@missionfloyd Thanks for the On another side, it could be very confusing if somebody writes code that should save 16 bit grayscale image as JPEG, but the quality of the saved images is worse than expected. |
JPEG doesn't support 16 bit, thus the error, |
related PR #7564 |
another related PR #7650 |
@w-e-w ACK #7650. Will keep an eye on #7564 and rebase when it lands. Or maybe you could just take my patch and append it to your MR. Another reason why not to try to convert 16bit monochrome JPEGs: |
yes I could, but I prefer to keep the issue separate I think it's easier for AUTO to understand what's going on there is also a chance that AUTO decides to take a different approach |
should be fixed by fb2354c |
Do not export for 4chan if conversion to JPEG is not possible. This prevents an exception when trying to save large depthmaps when export_for_4chan setting is on. See #6065