title: Loading image into ImageSource - incorrect width and height
body: <p>My problem is that the image loading seems to be uncorrectly from application resources. This is code:</p>
  
  <pre><code>    BitmapImage bi = new BitmapImage();
      bi.BeginInit();
      bi.UriSource = new Uri(@"pack://application:,,,/WpfApplication3;component/Resources/Images/16x16_incorrect.png", UriKind.Absolute);
      bi.EndInit();
  
      ImageSource s = bi;
  </code></pre>
  
  <p>Image file <code>16x16_incorrect.png</code> is 16x16 32bpp PNG file, but after executing above code, <code>s.Width = s.Height = 21,59729</code>.... I also have another file - <code>16x16_correct.png</code>, when it is loaded, both the ImageSource's <code>Width</code> and <code>Height</code> are equal to 16,002. </p>
  
  <p>Other images each of them are loading incorrectly &amp; it looks blurred (or smoothly), because system stretches it from 16x16 to 21x21.</p>
  
  <ul>
  <li>correct image :  <a href="https://i.stack.imgur.com/ooccZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ooccZ.png" alt="Correct Image"></a></li>
  <li>incorrect image : <a href="https://i.stack.imgur.com/Y0NbE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y0NbE.png" alt="Incorrect Image"></a></li>
  </ul>
  
  <p>What is causing this? If the problem in source image files, how can I change <code>ImageSource.Width</code> to desired size in order to use this files?</p>