Why not just do something like
import numpy as np clientImage = np.array(list(bitmapBits), np.uint8).reshape(height, width, 4)
For example, let ('Ri', 'Gi', 'Bi', 'ai') be the color tuple corresponding to pixel i . If you have a large tuple, you can do:
In [9]: x = ['R1', 'G1', 'B1', 'a1', 'R2', 'G2', 'B2', 'a2', 'R3', 'G3', 'B3', 'a3', 'R4', 'G4', 'B4', 'a4'] In [10]: np.array(x).reshape(2, 2, 4) Out[10]: array([[['R1', 'G1', 'B1', 'a1'], ['R2', 'G2', 'B2', 'a2']], [['R3', 'G3', 'B3', 'a3'], ['R4', 'G4', 'B4', 'a4']]], dtype='|S2')
Each fragment [:,:,i] for i in [0,4) will provide you with each channel:
In [15]: np.array(x).reshape(2, 2, 4)[:,:,0] Out[15]: array([['R1', 'R2'], ['R3', 'R4']], dtype='|S2')