title: Displaying a grayscale Image
body: <p>My aim:</p>
  
  <ol>
  <li>Read an image into the PIL format. </li>
  <li>Convert it to grayscale. </li>
  <li>Plot the image using pylab.</li>
  </ol>
  
  <p>Here is the code i'm using:</p>
  
  <pre><code>from PIL import Image
  from pylab import *
  import numpy as np
  
  inputImage='C:\Test\Test1.jpg'
  ##outputImage='C:\Test\Output\Test1.jpg'
  
  pilImage=Image.open(inputImage)
  pilImage.draft('L',(500,500))
  imageArray= np.asarray(pilImage)
  
  imshow(imageArray)
  
  ##pilImage.save(outputImage)
  
  axis('off')
  
  show()
  </code></pre>
  
  <p>My Problem:
  The image get's displayed like the colours are inverted.</p>
  
  <p><img src="https://i.stack.imgur.com/hqXYw.jpg" alt="This is the Original Image"></p>
  
  <p><img src="https://i.stack.imgur.com/5KvOg.png" alt="This is how it appears in the Python Window"></p>
  
  <p>But I know that the image is getting converted to grayscale, because when I write it to the disk it is appearing as a grayscale image.(Just as I expect).</p>
  
  <p>I feel that the problem is somewhere in the numpy conversion.</p>
  
  <p>I've just started programming in Python for Image Processing.
  And Tips and Guideline will also be appreciated.</p>