PDA

View Full Version : Imgbuffer pixels to byte array



Unregistered
March 22, 2005, 03:16:47
Hello,

I am attempting to copy the pixel data from the image buffer to a byte array so that I can then send it through a socket over the network. I have been able to successfully do this but it is slow.

Slow code portion:
For y = 0 To ImgBuffer.Lines * ImgBuffer.PixelPerLine * ImgBuffer.BitsPerPixel / 8 - 1

bmpbyte(y + 54) = ImgBuffer(y) '54 offset is for BMP header
Next

My original method for sending was to save the image to disk, read it back and then put it into the array to send. That seems like a waste to perform all that disk accessing so I am looking for a better method.

Any suggestions on a quicker way to move the pixel data into an array?

Tim Cassens
March 22, 2005, 12:04:04
Hello,

please have a look at the ImageBuffer.Bitmap property. It returns a System.Drawing.Bitmap object containing the image data of the frame.

Maybe it is even possible to write this Bitmap object directly into a NetworkStream by using its overloaded Save method.