Tanmay Sarkar

Tanmay Sarkar

  • NA
  • 1.5k
  • 1m

Trouble to get pixel from 1024x768 image

Sep 9 2010 1:20 PM
If i simple want to add color value in richtextbox for small image like 250x250 then it well work,

 richTextBox1.Text = "";
Bitmap objBitmap = new Bitmap(pictureBox1.Image);
String info = "";
for (int y = 0; y < objBitmap.Height; y++)
{
for (int x = 0; x < objBitmap.Width; x++)
{
Color col = objBitmap.GetPixel(x, y);
info = info + Convert.ToString(col.R) + "\t" + Convert.ToString(col.G) + "\t" + Convert.ToString(col.B) + Environment.NewLine;
}
}
richTextBox1.Text ="R\tG\tB"+Environment.NewLine+ info;

but for huge size like 1024x768 it take too much time & if there was too many application run then it became hang.

Please help me to retrieve all the pixel value from a 1024x768 image in short time span.

Thank you in advance!

Answers (4)