Try this
Only compatible with .Net FW 4 . Insure that you have that
Bitmap image1;
private void Button1_Click(System.Object sender, System.EventArgs e)
{
try
{
image1 = new Bitmap(@"C:\Documents and Settings\All Users\"
+ @"Documents\My Music\music.bmp", true);
int x, y;
for(x=0; x<image1.width;> {
for(y=0; y<image1.height;> {
Color pixelColor = image1.GetPixel(x, y);
Color newColor = Color.FromArgb(pixelColor.R, 0, 0);
image1.SetPixel(x, y, newColor);
}
}
PictureBox1.Image = image1;
Label1.Text = "Pixel format: "+image1.PixelFormat.ToString();
}
catch(ArgumentException)
{
MessageBox.Show("There was an error." +
"Check the path to the image file.");
}
}