Seriously, how hard did you try looking for this?
I don't like the lockbits code above, btw. You see it a lot, but unmanagedness of it bothers me. Here's a simple test I wrote:
CODE
using System;
using System.Drawing;
using System.Drawing.Imaging;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Bitmap srcBmp = new Bitmap("logo.gif");
Bitmap dstBmp = new Bitmap(srcBmp.Width, srcBmp.Height);
for (int y = 0; y < srcBmp.Height; y++) {
for (int x = 0; x < srcBmp.Width; x++) {
Color pix = srcBmp.GetPixel(x, y);
double greyLevel = pix.R*0.299 + pix.G*0.587 + pix.B*0.144;
if (greyLevel > 255) { greyLevel = 255; }
int g = (int)(greyLevel);
dstBmp.SetPixel(x, y, Color.FromArgb(0,g,0));
}
}
dstBmp.Save("logo.png", ImageFormat.Png);
}
}
}
I lifted the greyLevel code from
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c85c.aspx, which has lots of good stuff.
The result, well, I thought our logo wanted some green...