I have an image in NumPy array format and I want save it to my disk. I used this code:
from PIL import Image
....
Image.fromarray(img).save('res.png')
But it saved as 8-bit. How can I make it save as 16-bit?
I have an image in NumPy array format and I want save it to my disk. I used this code:
from PIL import Image
....
Image.fromarray(img).save('res.png')
But it saved as 8-bit. How can I make it save as 16-bit?
I believe the answer at https://stackoverflow.com/a/25814423/727533 may be what you're looking for. It describes using PyPNG to output a NumPy array as a PNG.