I wrote a program to convert a bitmap to gray(in c#) . But why it runs
so slow?? More slower than I wrote in Delphi?? They have the same
algorithm.
Bitmap openBitmap = new Bitmap(openBitmapDialog.FileName);
Color oldColor = new Color();
int grayValue;
for (int i = 0; i < openBitmap.Width; i++)
for (int j = 0; j < openBitmap.Height; j++)
{
oldColor = openBitmap.GetPixel(i, j);
grayValue = (int)(oldColor.R * 0.299 +
oldColor.G * 0.587 + oldColor.B * 0.114);
oldColor = Color.FromArgb(grayValue, grayValue,
grayValue);
openBitmap.SetPixel(i, j, oldColor);
}
sourcePictureBox.Image = openBitmap;
Thx for your
replies