2011-02-01 63 views
13

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

回答

25

正如tkerwin提到,改變BitmapScalingModeNearestNeighbor在你XAML圖像代碼:

RenderOptions.BitmapScalingMode="NearestNeighbor" 
0

提高分辨率/規模沒有抗鋸齒。

發生了什麼是WPF縮放圖像,但「平均」的像素,而不是做一個更多的塊狀尺度。

看到這個職位:

Resize bitmap like in MS Paint

+0

我在500x500圖像控件中使用50x50分辨率的圖像。我想要沒有抗鋸齒的圖像。我怎麼才能得到它? – 2011-02-01 19:46:18

15

也許你需要更改位圖縮放模式近鄰。

RenderOptions.BitmapScalingMode="NearestNeighbor"添加到您的圖片標籤。

+0

請問您可以顯示代碼示例嗎? – 2011-02-01 19:56:23