I've got an array that I can process like this:
ba = bytearray(fh.read())[32:]
size = int(math.sqrt(len(ba)))
I can tell if a pixel should be black or white given
iswhite = (ba[i]&1)==1
How can I quickly convert my 1D byte array into a 2D numpy array with row length size and white pixels for (ba[i]&1)==1 and black for others? I create the array like this:
im_m = np.zeros((size,size,3),dtype="uint8)