Wpf - Resizing icon, blurry image quantity

I'm attempting to first pull a icon from an executable file, save it to a particular file and display that in a WPF window.

The quality is perfectly fine at 32x32 but when I try to resize it to being larger, it starts to get blurry.

Image from my application, 32x32 image beside 100x100 image:

As you can see, it's quite blurry, by comparison here's an image from a different application which is getting the icon from executable also (and even larger) so it's obviously possible.

There are several topics on this (or at least related) but I'm not managed to figure out what exactly the problem is.

I'm displaying the image using this code.

<Image Height="100" 
       Width="100" 
       HorizontalAlignment="Left" 
       Source="{Binding ImagePath}" 
       RenderOptions.BitmapScalingMode="HighQuality"/>

I assume the issue is with the displaying of the image rather then how it's saved initially but just in case...I'm saving the image using this code.

Bitmap image = Icon.ExtractAssociatedIcon(FilePath).ToBitmap();   
image.Save(imagePath, System.Drawing.Imaging.ImageFormat.Png);

Answers


ExtractAssociatedIcon only gets the 32x32 icon, even if the app's resources have others. You'll probably have to go all the way to p/invoke something to get any of the other icons in an exe.


Need Your Help

Sending keystrokes from a C# application to a Java application - strange behaviour?

c# java sendkeys findwindow

I'm trying to send keystrokes from my C# program to a Java application

failing to login with jsp, bean and servlet

java jsp servlets javabeans

I've written this code to login from jsp using a bean and servlet that checks username and password

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.