473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pixel array to PictureBox

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
Nov 17 '05 #1
2 4607

victor wrote:
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.

--
Larry Lard
Replies to group please

Nov 17 '05 #2
On 27 Oct 2005 05:36:14 -0700, "Larry Lard" <la*******@hotmail.com>
wrote:
APPRECIATE IT!
Thanks for your extensive advise !
vic

victor wrote:
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.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: CoreyMas | last post by:
Hello All, Here is what I would like to do I am creating a game program that displays a map (preferably in hexes but that is another matter) and whenever the user is over the "map" I want to...
1
by: Raju | last post by:
Is there any way to get and set the pixel value in a container control(form, picturebox...)?
1
by: MAY | last post by:
hi, i m new in C#....... here have the simple question abt GDI+ i draw some lines and rectangle into a picturebox by using pen and brush. By what way, i can check a particular of pixel on this...
3
by: Dean Slindee | last post by:
I want to build an array on the fly in code with a parameter passed for the number of elements in the array. I am trying to do this by looping, but get an array with just one element in the end....
2
by: fripper | last post by:
I am using VB 2005 and want to generate a graphic in a picture box control where the color of each pixel is determined by particular values calculated for each pixel. These values are manipulated...
3
by: Mark Ingram | last post by:
Hi, ive got an imagine in a PictureBox, and would like to get the colour of the pixel when the mouse is over the control. From what ive (briefly) seen, there is no way to do this directly in C# and...
4
by: Charles | last post by:
Hello Everyone, I have been gettting great feedback from microsoft.public.vc.language group but after doing more searching I think my post should be directed to this group. I am trying to make...
3
by: Vrijbuiter | last post by:
I want to detect a pixel color number when i move the mouse over de picturebox. I think the next line has the color but i don't now how i get it: System.Drawing.Point pt = new Point() ; pt.X...
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.