5

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?

101
  • 8,514
  • 6
  • 43
  • 69
user6091779
  • 51
  • 1
  • 1
  • 2

1 Answers1

5

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.

Community
  • 1
  • 1