Trying to read bin content of 12 bits grayscale image

Hi, so I’m not 100% sure, but I think you can’t get the full information from the png: It’s a “PNG image data, 1213 x 1017, 8-bit grayscale, non-interlaced”, so 8-bit per pixel, whereas your data seems to be 12 bit originally. If I compare the start of the file I get from ROOT (p[i] & 0xff), I get

[7, 0, 2, 4, 2, 2, 5, 2, 8, 8, 18]

compared to the first line of the txt
89 0 30 65 34 37 75 32 126 107 267
It looks like 12 bit data mapped into 8 bit data (~factor of 16), and you can’t get the full resolution from the png.

Sorry.