title: numpy with python: convert 3d array to 2d
body: <p>Say that I have a color image, and naturally this will be represented by a 3-dimensional array in python, say of shape (n x m x 3) and call it img.</p>
  
  <p>I want a new 2-d array, call it "narray" to have a shape (3,nxm), such that each row of this array contains the "flattened" version of R,G,and B channel respectively. Moreover, it should have the property that I can easily reconstruct back any of the original channel by something like</p>
  
  <pre><code>narray[0,].reshape(img.shape[0:2])    #so this should reconstruct back the R channel.
  </code></pre>
  
  <p>The question is how can I construct the "narray" from "img"? The simple img.reshape(3,-1) does not work as the order of the elements are not desirable for me.</p>
  
  <p>Thanks</p>