title: Converting image to black and white and use it as array
body: <p>I'm trying to convert a colored image to a black and white one.</p>
  
  <p>The original image is the following:</p>
  
  <p><img src="https://i.stack.imgur.com/wWH3K.png" alt=""></p>
  
  <p>I have a few problems. First:</p>
  
  <pre><code>import pylab as pl
  import Image
  
  im = Image.open('joconde.png')
  
  pl.imshow(im)
  pl.axis('off')
  pl.show()
  </code></pre>
  
  <p>I get this:</p>
  
  <p><img src="https://i.stack.imgur.com/VMhMa.png" alt="First result"></p>
  
  <p>Why is it rotated? That's not the point but I'd like to know why.</p>
  
  <pre><code>im_gray = im.convert('1')
  
  pl.imshow(im_gray)
  pl.show() 
  </code></pre>
  
  <p>And here is the processed black and white image:</p>
  
  <p><img src="https://i.stack.imgur.com/zBSth.png" alt=""></p>
  
  <p>Now everything looks working. But I need to use that image as a numpy array in order to do some image processing. All I have to do is this:</p>
  
  <pre><code>import numpy as np
  
  im_arr = np.array(im_gray)
  
  pl.imshow(im_arr)
  pl.axis('off')
  pl.show()
  </code></pre>
  
  <p>But I get this:</p>
  
  <p><img src="https://i.stack.imgur.com/29bdK.png" alt=""></p>
  
  <p>Why is this happening? I tried also:</p>
  
  <pre><code>im_arr = np.array(im_gray, dtype='float')
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>im_arr = np.asarray(im_gray)
  </code></pre>
  
  <p>But nothing seems working. Maybe the problem is in the <code>show</code> method but I don't know.</p>