WPF Image, how to remove blur?
I have
I need
XAML:
<Image Height="500"
MouseLeftButtonDown="image_MouseL开发者_运维问答eftButtonDown"
MouseRightButtonDown="image_MouseRightButtonDown"
Name="image"
Stretch="Fill"
Width="500" />`
C#:
wbmap = new WriteableBitmap(50, 50, 500, 500, PixelFormats.Indexed8, palette);
wbmap.WritePixels(new Int32Rect(0, 0, wbmap.PixelWidth, wbmap.PixelHeight), pixels, wbmap.PixelWidth * wbmap.Format.BitsPerPixel / 8, 0);
image.Source = wbmap;
As tkerwin mentioned, change the BitmapScalingMode to NearestNeighbor
in you XAML Image code:
RenderOptions.BitmapScalingMode="NearestNeighbor"
Perhaps you need to change the bitmap scaling mode to nearest neighbor.
Add RenderOptions.BitmapScalingMode="NearestNeighbor"
to your Image tag.
Increase resolution / scale without anti-aliasing.
Whats happening is WPF is scaling the image but "averaging" the pixels, rather than doing a more blocky scale.
See this post:
Resize bitmap like in MS Paint
精彩评论