title: import image to python as 2D array
body: <p>I'm just wondering is there a way to import an image in python using numpy and PIL to make it a 2D array? Furthermore if I have a black and white image is it possible to set the black to 1 and white to zero?</p>
  
  <p>currently I'm using:</p>
  
  <pre><code>temp=np.asarray(Image.open("test.jpg"))
  frames[i] = temp #frames is a 3D array
  </code></pre>
  
  <p>With this I get an error:</p>
  
  <p>ValueError: operands could not be broadcast together with shapes (700,600) (600,700,3) </p>
  
  <p>I'm new to python but as far as I can tell this means that basically temp is a 3D array and i'm assigning it to a 2D array?</p>