Click to See Complete Forum and Search --> : Image class and Stream class


eloberg
January 27th, 2003, 08:20 AM
I have an array of gray level bytes I want to show on screen. In order to do that I use Stream and Image classes like the following:

Stream strm;
Image img;
Graphics grfx;
strm.Write(pByteArray,0,nSize);
img = Image.FromStream(strm);
grfx.DrawImage(0,0,width,height);

But I get an error saying:

Use of unassigned local variable strm in the statement
img = Image.FromStream(strm);

What have I done wrong?

pareshgh
January 27th, 2003, 10:17 AM
make use of MemoryStream instead and make an instance of it first and then use it.

since Stream is an abstract class you can't make instance i.e. you can't do new of it.

Paresh