Skip to main content

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.

Comments

Popular posts from this blog

create a table in SQL

To create a table, you can follow this formula: CREATE TABLE Country( Column1 , Column2 , Column3 ) or: CREATE TABLE Country( Column1 , Column2 , Column3 ); Each column is created as: ColumnName DataType Options Here is an example: CREATE TABLE Customers ( DrvLicNbr nvarchar(32), DateIssued DATE, DateExpired date, FullName nvarchar(50), Address NVARCHAR(120), City NvarChar(40), State NVarChar(50), PostalCode nvarchar(20), HomePhone nvarchar(20), OrganDonor BIT); GO To start from a sample code, open an empty Query window and display the Template Explorer. From the Template Explorer, expand Table. Drag Create Table and drop it in the Query window: -- ========================================= -- Create table template -- ========================================= USE <database, sysname, AdventureWorks> GO IF OBJECT_ID('<schema_name, sysname, dbo>.<table_name, sysname, sample_table>', 'U') IS NOT NULL DROP TABLE <schema_name, sysname, d...

Stored Procedures

Practical Learning: Introducing Stored Procedures Start Microsoft  SQL  Server  Management  Studio  and log in to your  server On the main menu, click File -> New -> Query With Current Connection To create a new database, copy and paste the following code in the Query window:   -- ============================================= -- Database: WattsALoan -- ============================================= USE master GO -- Drop the database if it already exists IF EXISTS ( SELECT name FROM sys.databases WHERE name = N'WattsALoan' ) DROP DATABASE WattsALoan GO CREATE DATABASE WattsALoan GO -- ========================================= -- Table: Employees -- ========================================= USE WattsALoan GO IF OBJECT_ID(N'dbo.Employees', N'U') IS NOT NULL DROP TABLE dbo.Employees GO CREATE TABLE dbo.Employees ( EmployeeID int identity(1,1) NOT NULL, EmployeeNumber nchar(10) NULL, FirstName nvarchar(20) NULL, LastName nvarcha...

Delete a table in SQL

To delete a table using SQL, use the following formula: DROP TABLE TableName The  DROP TABLE  expression is required and it is followed by the name of the undesired table. Here is an example: DROP TABLE Students; GO