-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Converting I;16B PNG to RGB ruins the image #5991
Comments
Would you mind attaching a copy of your image? |
Hello @radarhere ! thank you very much for your reply :) This is the original image in F mode (32 bit grayscale aka 1 channel) when i try to convert it using .convert('RGB'), it becomes this Almost all parts are lost :( |
From looking at the image, I conclude that it's not actually in F mode, but I;16B. Unfortunately, Pillow does not have very good support for I;16 modes at the moment. Also, when I try to convert to RGB, my image becomes too bright, rather than too dark. If you are looking for an immediate solution, I did from PIL import Image
im = Image.open('input.png')
im.point(lambda i: i * (1 / 255)).convert("RGB").save("output.png") but since yours is too dark, I would suggest from PIL import Image
im = Image.open('input.png')
im.point(lambda i: i * 255).convert("RGB").save("output.png") |
Hello! thank you very much for this! although there was still some info loss when converting, it significantly improved using the code you provided! Thank you again :) |
Hello! I have a image grayscale image (spectrogram) that looks fine on 32bit (F), but when i try to convert it to RGB, most data is loss, that means the image is almost fully black (majority of the white/gray parts turned to black!), would just like to know how to resolve this. Thank you very much in advance!
The text was updated successfully, but these errors were encountered: