title: Get grayscale Image height without considering white pixels
body: <p>I have grayscale pictures of an <code>ArrayList&lt;System.Windows.Controls.Image&gt;</code> laid out horizontally on a <code>Canvas</code>. Their <code>ImageSource</code> are of type <code>System.Windows.Media.Imaging.BitmapImage</code>.</p>
  
  <p>Is there a way to measure in pixels the height of each <code>Image</code> <em>without considering white, non-transparent pixels Outside the colored part</em> ? </p>
  
  <p>Lets say I have an <code>Image</code> of height <code>10</code>, in which the whole top half is white and the bottom half is black; I would need to get <code>5</code> as it's height. In the same way, if that <code>Image</code> had the top third black, middle third white and bottom third black, the height would be <code>10</code>.</p>
  
  <p>Here's a drawing that shows the desired heights (in blue) of 3 images:</p>
  
  <p><a href="https://i.stack.imgur.com/ZKGPB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZKGPB.png" alt="Example picture"></a></p>
  
  <p>I am willing to use another type for the images, but it Must be possible to either get from a <code>byte[]</code> array to that type, or to convert <code>Image</code> to it.</p>
  
  <p>I have read the docs on <code>Image</code>, <code>ImageSource</code> and <code>Visual</code>, but I really have no clue where to start.</p>