WPF图像,如何去除模糊?

问题描述:

enter image description hereWPF图像,如何去除模糊?

我需要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; 
+1

请提供更多的细节!你是如何在第一张图片中看到Blur的?是在XAML中生成的吗? – 2011-02-01 19:43:11

+0

我改变了这个问题。 – 2011-02-01 19:54:46

正如tkerwin提到,改变BitmapScalingModeNearestNeighbor在你XAML图像代码:

RenderOptions.BitmapScalingMode="NearestNeighbor" 

提高分辨率/规模没有抗锯齿。

发生了什么是WPF缩放图像,但“平均”的像素,而不是做一个更多的块状尺度。

看到这个职位:

Resize bitmap like in MS Paint

+0

我在500x500图像控件中使用50x50分辨率的图像。我想要没有抗锯齿的图像。我怎么才能得到它? – 2011-02-01 19:46:18

也许你需要更改位图缩放模式近邻。

RenderOptions.BitmapScalingMode="NearestNeighbor"添加到您的图片标签。

+0

请问您可以显示代码示例吗? – 2011-02-01 19:56:23