title: Convert 3 dim image array to 2 dim
body: <p>Using this code : </p>
  
  <pre><code>from scipy import misc
  import matplotlib.pyplot as plt
  
  images = data.test.images[0:9]
  plt.imshow(images[0].reshape(28 , 28))
  
  print(images[0].shape)
  </code></pre>
  
  <p>I plot the image :</p>
  
  <p><a href="https://i.stack.imgur.com/kENHN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kENHN.png" alt="enter image description here"></a></p>
  
  <p>Using <code>misc</code> from <code>scipy</code> :</p>
  
  <pre><code>face = misc.face()
  misc.imsave('face.png', face) # First we need to create the PNG file
  face = misc.imread('face.png')
  
  print(face.shape)
  plt.imshow(face)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/9btsX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9btsX.png" alt="enter image description here"></a></p>
  
  <p>I plot image : </p>
  
  <p>How to convert <code>face</code> to 2 dimensional image which can be plotted using <code>plt.imshow</code> ?</p>
  
  <p>Using :</p>
  
  <pre><code>plt.imshow(face.reshape(768 , 1024))
  </code></pre>
  
  <p>produces error : </p>
  
  <pre><code>ValueError                                Traceback (most recent call last)
  &lt;ipython-input-104-99fef1cec0d2&gt; in &lt;module&gt;()
        6 plt.imshow(face)
        7 
  ----&gt; 8 plt.imshow(face.reshape(768 , 1024))
  
  ValueError: cannot reshape array of size 2359296 into shape (768,1024)
  </code></pre>
  
  <p>I'm not attempting to convert the image to greyscale but to 2 dimensional instead of 3 dimensional.</p>
  
  <p>Update : </p>
  
  <p>Checking the a single pixel value : <code>print(face[0][0])</code> is : <code>[121 112 131]</code> . Should I take the average of <code>[121 112 131]</code> as part of reshaping ?</p>