title: Read in Raw Binary Image in Python
body: <p>I have a very simple script in Matlab that opens a 'raw' binary image file and displays it.  Is this easily reproducible using numpy in python?  I've come across various posts discussing unpacking, dealing with endian, specifying buffers, etc.  But this seems like it should be simple, based on how simple the matlab interface is</p>
  
  <pre><code>&gt;&gt; fileID = fopen('sampleX3.raw','rb')
  
  fileID =
  
       1
  
  &gt;&gt; A = fread(fileID,[1024,1024],'int16');
  size(A)
  
  ans =
  
          1024        1024
  
  &gt;&gt; max(max(A))
  
  ans =
  
         12345
  
  &gt;&gt; close all; figure; imagesc(A);
  </code></pre>