You need to use np.transpose to resize. Now nxmx 3 needs to be converted to 3 x (n*m) , so send the last axis to the foreground and shift the order of the remaining axes to the right (0,1) . Finally, change the shape to have lines 3 . So the implementation will be -
img.transpose(2,0,1).reshape(3,-1)
Run Example -
In [16]: img Out[16]: array([[[155, 33, 129], [161, 218, 6]], [[215, 142, 235], [143, 249, 164]], [[221, 71, 229], [ 56, 91, 120]], [[236, 4, 177], [171, 105, 40]]]) In [17]: img.transpose(2,0,1).reshape(3,-1) Out[17]: array([[155, 161, 215, 143, 221, 56, 236, 171], [ 33, 218, 142, 249, 71, 91, 4, 105], [129, 6, 235, 164, 229, 120, 177, 40]])