title: Interactive pixel information of an image in Python?
body: <p><strong>Short version:</strong> is there a Python method for displaying an image which shows, in real time, the pixel indices and intensities?  So that as I move the cursor over the image, I have a continually updated display such as <code>pixel[103,214] = 198</code> (for grayscale) or <code>pixel[103,214] = (138,24,211)</code> for rgb?</p>
  
  <p><strong>Long version:</strong></p>
  
  <p>Suppose I open a grayscale image saved as an ndarray <code>im</code> and display it with <code>imshow</code> from matplotlib:</p>
  
  <pre><code>im = plt.imread('image.png')
  plt.imshow(im,cm.gray)
  </code></pre>
  
  <p>What I get is the image, and in the bottom right of the window frame, an interactive display of the pixel indices.  Except that they're not quite, as the values are not integers: <code>x=134.64   y=129.169</code> for example.</p>
  
  <p>If I set the display with correct resolution:</p>
  
  <pre><code>plt.axis('equal')
  </code></pre>
  
  <p>the x and y values are still not integers.</p>
  
  <p>The <code>imshow</code> method from the <code>spectral</code> package does a better job:</p>
  
  <pre><code>import spectral as spc
  spc.imshow(im)
  </code></pre>
  
  <p>Then in the bottom right I now have <code>pixel=[103,152]</code> for example.</p>
  
  <p>However, none of these methods also shows the pixel values.  So I have two questions:</p>
  
  <ol>
  <li>Can the <code>imshow</code> from <code>matplotlib</code> (and the <code>imshow</code> from <code>scikit-image</code>) be coerced into showing the correct (integer) pixel indices?</li>
  <li>Can any of these methods be extended to show the pixel values as well?</li>
  </ol>