Anja
Anja

Reputation: 345

Python: How to read in a 16 bit .png grayscale image

I try to read in a 16bit grayscale image .png in python.

Neither

cv2.imread('test.png', cv2.IMREAD_ANYDEPTH)

nor

cv2.imread('test.png',-1)

is working. After reading in, my array is 8 bit. I'm confused, wether my image is a 16 bit image or not, because both prints me a 8 bit array (But I am pretty sure it is a 16 bit image). Is there a possibility to check it?

But does anyone know how to read in a 16 bit .png file to get an 16 bit array?

Upvotes: 1

Views: 5174

Answers (1)

Anja
Anja

Reputation: 345

It works fine with cv2.imread('test.png', -cv2.IMREAD_ANYDEPTH)

Upvotes: 3

Related Questions