Pixel array to PictureBox

  • Thread starter Thread starter victor
  • Start date Start date
V

victor

hello,

I have several arrays containing (image-) pixel data; I want to
display it onto a PictureBox.
What is the best Graphics method for it?
(MSDN examples talks only about loading it from file ...)
Thank you.
victor
 
victor said:
hello,

I have several arrays containing (image-) pixel data; I want to
display it onto a PictureBox.
What is the best Graphics method for it?
(MSDN examples talks only about loading it from file ...)
Thank you.
victor

There is a constructor for Bitmap that works with in-memory data.
Create a Bitmap, then display that in your PictureBox with
Graphics.DrawImage.

Bitmap Constructor (Int32, Int32, Int32, PixelFormat, IntPtr)

Initializes a new instance of the Bitmap class with the specified size,
pixel format, and pixel data.

public Bitmap(
int width,
int height,
int stride,
PixelFormat format,
IntPtr scan0
);

Parameters
width
The width, in pixels, of the new Bitmap object.
height
The height, in pixels, of the new Bitmap object.
stride
The memory size of a row in the stream of pixel data.
format
The PixelFormat enumeration for the new Bitmap object.
scan0
The address of a stream of pixel data.
 
Back
Top