Could you please help to unpack the binary file in Python 3? It is an image 2580*7839 size, 4-byte float. What I had in the code for Python 2 and it worked, but not in Python 3.
bformat= ">%sf"
ns = 2580*7839*4
#open file f
byte_arr=f.read(ns)
unpacked_bytes = unpack(bformat % (ns/4), byte_arr)
data=np.array(unpacked_bytes).reshape(7839,2580)
print ('min value', data.min())
print ('max value', data.max())
I get the error message "struct.error: bad char in struct format"
Thanks!
pixels = img.load()would be sufficient for every format when using PIL. Nevertheless it seems like the unpacking format doesn't match the old format, you might want to investigate in this, or just take the advantage of using a fully powered imaging library.