title: Displaying image from image raw data
body: <p>After reading pixel values from the image using the following code:</p>
  
  <pre><code>import os, sys
  import Image
  
  pngfile = Image.open('input.png')
  raw = list (pngfile.getdata())
  
  f = open ('output.data', 'w')
  for q in raw:
      f.write (str (q) + '\n')
  f.close ()
  </code></pre>
  
  <p>How one can display an image after reading the data stored in raw form? Is there any opposite function of getdata() to achieve this?</p>
  
  <p><img src="https://i.stack.imgur.com/Fo7H5.png" alt="enter image description here"></p>