Using this code example you can create grayscale images.
public Bitmap GrayScale(Bitmap Bmp)
{
int rgb;
Color c;
for (int y = 0; y <Bmp.Height; y++)
for (int x = 0; x <Bmp.Width; x++)
{
c = Bmp.GetPixel(x, y);
rgb = (int)((c.R + c.G + c.B) / 3);
Bmp.SetPixel(x, y, Color.FromArgb(rgb, rgb, rgb));
}
return Bmp;
}
Member
3 Points
56 Posts
Change Bitmap Resolution and Turn Black & White
Sep 02, 2010 04:33 AM|togius|LINK
i use this method to resize bitmaps.
My question is how can i Change Bitmap Resolution and Turn Black & White?
Contributor
4050 Points
1004 Posts
MVP
Re: Change Bitmap Resolution and Turn Black & White
Sep 02, 2010 06:29 AM|DigiMortal|LINK
Using this code example you can create grayscale images.
You can read more about this example from my blog posting How to create grayscale images on .NET.
Also visit my ASP.NET blog or follow me @ Twitter:twitter.com/gpeipman
Member
3 Points
56 Posts
Re: Change Bitmap Resolution and Turn Black & White
Sep 02, 2010 08:45 AM|togius|LINK
thanks digimortal