Lee Wade

Lee Wade

  • NA
  • 1
  • 0

Get RGB from pixel via image buffer

Jun 27 2008 8:57 AM

Hi, I am new to C# and im working on image processing, im using this bit of code to invert the pixels on an image, how do I extract the RGB values from a pixel in C# using the image buffer?

Thanks.


unsafe
  {
    byte* p = (byte *)(void *)pBuffer;
    int nWidth = Width * 3;
    for(int y = 0; y < Height; y++)
    {
      for(int x = 0; x < nWidth; x++ )
       {
         p[0] = (byte)(255-p[0]);
         p++;


Answers (1)