title: Numpy remove a dimension from np array
body: <p>I have some images I want to work with, the problem is that there are two kinds of images both are 106 x 106 pixels, some are in color and some are black and white. </p>
  
  <p>one with only two (2) dimensions:</p>
  
  <p>(106,106)</p>
  
  <p>and one with three (3)</p>
  
  <p>(106,106,3)</p>
  
  <p>Is there a way I can strip this last dimension?</p>
  
  <p>I tried np.delete, but it did not seem to work.</p>
  
  <pre><code>np.shape(np.delete(Xtrain[0], [2] , 2))
  Out[67]: (106, 106, 2)
  </code></pre>