title: Python - Using f.open to read an image file -> Convert to numpy array
body: <p>I have an image file called "test.png"</p>
  
  <p>I want to be able to read the image file as follows: </p>
  
  <pre><code>with open("test.png", "rb") as f:
          input = f.read()
  
  #Do some pre-processing on "input"
  
  input_array = #some operation on the variable "input" to convert it to a numpy array
  
  #processing "input_array"
  
  output_dat = #some operation to convert input_array into the same format as variable "input"
  </code></pre>
  
  <p>Now, I want to be able to turn this <code>input</code> data into a numpy array. How would I go about doing this, and vice-versa i.e., I also want to be able to convert it back to the format as <code>input</code> is in. </p>
  
  <ol>
  <li>Convert <code>input</code> to a numpy array format</li>
  <li>Convert numpy array back to the same format as <code>input</code></li>
  </ol>