Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Image, how to remove blur?

I have enter image description here

I need enter image description here

XAML:

<Image Height="500"
       MouseLeftButtonDown="image_MouseLeftButtonDown"
       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;
like image 426
Eugene Gluhotorenko Avatar asked Feb 01 '11 19:02

Eugene Gluhotorenko


2 Answers

As tkerwin mentioned, change the BitmapScalingMode to NearestNeighbor in you XAML Image code:

RenderOptions.BitmapScalingMode="NearestNeighbor"
like image 158
SwDevMan81 Avatar answered Nov 02 '22 07:11

SwDevMan81


Perhaps you need to change the bitmap scaling mode to nearest neighbor.

Add RenderOptions.BitmapScalingMode="NearestNeighbor" to your Image tag.

like image 19
tkerwin Avatar answered Nov 02 '22 08:11

tkerwin