Please see my comment to the question. But its most likely that you mean
System.Drawing.Bitmap
and for this class the solution is the use of
System.Drawing.Bitmap.LockBits
:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.lockbits.aspx[
^].
Clink on the link on the first of the two methods referenced on the page referenced above; it has a good code sample.
Most important thing here is not to try to use
GetPixel
in a loop, as this method is prohibitively slow. That's all the whole idea of locking bits in memory is about. Note that you need to learn the memory layout for the
PixelFormat
you're using. See also:
http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx[
^].
—SA