title: Distortion when resizing/scaling WPF Image
body: <p>I have a program that displays an image, and the user can resize the image in the window (e.g. by rolling the mouse wheel).  I scale the image using a RenderTransform, like this:</p>
  
  <pre><code>&lt;Image x:Name="CurrentImage"&gt;
      &lt;Image.RenderTransform&gt;
          &lt;TransformGroup&gt;
              &lt;TranslateTransform x:Name="Translate" X="0" Y="0"/&gt;
              &lt;ScaleTransform x:Name="Scale" ScaleX="1" ScaleY="1"/&gt;
          &lt;/TransformGroup&gt;
      &lt;/Image.RenderTransform&gt;
  &lt;/Image&gt;
  </code></pre>
  
  <p>Then I just change the <code>ScaleX</code> and <code>ScaleY</code> properties.  The image resizes as expected.</p>
  
  <p>However, at certain scales, the image gets very distorted.  Below about 20% and above about 80% it displays fine, but for resolutions in between, some or all of the image is distorted.  See screenshots below.</p>
  
  <p>A couple other details:</p>
  
  <ul>
  <li>the 2 Windows XP machines I tried this on had the same corruption, but a Windows 7 laptop did NOT exhibit the problem.</li>
  <li>I also tried replacing the <code>RenderTransform</code> with just scaling the Image by itself using the <code>Height</code> and <code>Width</code> properties, but it made no difference.</li>
  <li>Not all images have a problem, and the ones that do will sometimes do it at different scale factors.  Larger images seem to be worse, but I have not systematically measured.</li>
  <li>.NET 3.5 and .NET 4 RC both exhibit the behavior.</li>
  </ul>
  
  <p>Has anyone seen this behavior before, and do you have any thoughts?</p>
  
  <p><strong>At 20% of original size:</strong></p>
  
  <p><a href="http://maylark.com/Scale20.png" rel="nofollow noreferrer">alt text http://maylark.com/Scale20.png</a></p>
  
  <p><strong>At 26% of original size:</strong></p>
  
  <p><a href="http://maylark.com/Scale26.png" rel="nofollow noreferrer">alt text http://maylark.com/Scale26.png</a></p>
  
  <p><strong>At 41% of original size:</strong></p>
  
  <p><a href="http://maylark.com/Scale41.png" rel="nofollow noreferrer">alt text http://maylark.com/Scale41.png</a></p>
  
  <p><strong>At 64% of original size:</strong></p>
  
  <p><a href="http://maylark.com/Scale64.png" rel="nofollow noreferrer">alt text http://maylark.com/Scale64.png</a></p>
  
  <p><strong>At 80% of original size:</strong></p>
  
  <p><a href="http://maylark.com/Scale80.png" rel="nofollow noreferrer">alt text http://maylark.com/Scale80.png</a></p>