المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Converting an particular color in an image to another color



C# Programming
11-22-2010, 05:21 AM
Hello i have this grayscale image and i wan to convert the pixel black all to white.

for (int i = 0; i < grayImage.Height; i++)
{
for (int j = 0; j < grayImage.Width; j++)
{
if (grayImage.GetPixel(j, i).A.ToString() == "0" && grayImage.GetPixel(j,
i).B.ToString() == "0" && grayImage.GetPixel(j, i).G.ToString() ==
"0" && grayImage.GetPixel(j, i).R.ToString() == "0")
{

grayImage.SetPixel(j, i, Color.White);


}

}

}
pictureBox5.Image = grayImage;

i use the above code however it dont seems like it is working when i assign the grayscale image to another pictureBox it appear as the original image.

needing help!
modified on Sunday, November 21, 2010 11:00 AM