It works now, thanks for your answer!
Lenquist
Posts
-
Problems converting color image to grayscale [modified] -
Problems converting color image to grayscale [modified]Already tried few different formulas (the one you proposed also) for calculating a gray pixel always with the same (bad looking) results.
-
Problems converting color image to grayscale [modified]Hi everyone, it's my first post so be gentle :). I'm having difficulties converting a colored image to grayscale in a silverlight application. Clicking the link you can see the results of my code (left is the original pic right the resulting grayscale pic): Link I have no idea what I'm doing wrong. It should work but it doesn't. Help would be appreciated! One other thing, the WriteableBitmap.setPixel and WriteableBitmap.getPixel functions are part of the WritableBitmapEx library downloaded from Codeplex. Here's the code:
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
convertToGrayscale(new WriteableBitmap((BitmapSource)this.Original.Source));
}public void convertToGrayscale(WriteableBitmap image) { var p = image.Pixels; for(int y=0; y
modified on Sunday, September 26, 2010 8:09 AM