WPF 4 Lowers Default BitmapScalingMode Quality

If you’ve recently upgraded a .NET 3.5 WPF application to .NET 4.0, you may have noticed that some of your images look like crap. This is because Microsoft has changed how WPF rescales images. Instead of the original high quality, it has been lowered to low quality. This was done, they say, to improve performance.

Here’s some images that demonstrate what’s going on. I created an application and did nothing except change the target version of the .NET framework. .NET 3.5 is on the left and .NET 4.0 is on the right.

The clock image is courtesy of Paul R. Hayes.

There’s no way to change the default scaling mode in WPF, however you can put a style in your App.xaml or some other high-level place and have it apply to all of your images.

<Window.Resources>
    <Style TargetType="{x:Type Image}">
        <Setter Property="RenderOptions.BitmapScalingMode"
               Value="HighQuality" />
    </Style>
</Window.Resources>

I have mixed feelings on the change. The downside is that some apps will look quite a bit different when switching to .NET 4.0. The upsides is, however, that the low quality scaling mode is entirely done in the GPU, which means the performance will be way better than the CPU-only high quality scaling.

Leave a Reply

Your email address will not be published. Required fields are marked *