title: After I convert a 2D grayscale PIL image to a 1D numpy array, what is the smoothest way to get to a 2D numpy array (an image/matrix)?
body: <p>My code looks like this:</p>
  
  <pre><code>img = Image.open(path)
  pix = np.asarray(img)
  # i tried to access an (x,y) pixel and found the array was one dimensional
  print str(float(pix[1,1])), "\t",
  </code></pre>
  
  <p>I need to shuffle the 1D array so that it is 2D so I can access (x,y) pixels.  What is the smoothest way to do this?</p>
  
  <p>I get this error for the above:</p>
  
  <pre><code>IndexError: too many indices for array
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Below is some info collected from the terminal after executing the above code.  np.asarray() is clearly doing something, and the information about the dimension of the image is still contained in the ndarray <code>pix</code>  --  <code>array(&lt;PIL.TiffImagePlugin.TiffImageFile image mode=I;16 size=1280x1080 at 0x110CA9F38&gt;, dtype=object)</code>. </p>
  
  <pre><code>&gt;&gt;&gt; img
  &lt;PIL.TiffImagePlugin.TiffImageFile image mode=I;16 size=1280x1080 at 0x110CA9F38&gt;
  &gt;&gt;&gt; pix
  array(&lt;PIL.TiffImagePlugin.TiffImageFile image mode=I;16 size=1280x1080 at 0x110CA9F38&gt;, dtype=object)
  &gt;&gt;&gt; type(img)
  &lt;type 'instance'&gt;
  &gt;&gt;&gt; type(pix)
  &lt;type 'numpy.ndarray'&gt;
  &gt;&gt;&gt; img.size
  (1280, 1080)
  &gt;&gt;&gt; pix.size
  1
  </code></pre>