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:
Image http://img821.imageshack.us/img821/8967/imageresizemine.jpgAs 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.
Image http://img714.imageshack.us/img714/1842/imageresizeother.jpgThere 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);
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.
精彩评论