Convert GD-Sharp Stream to Bitmap

im currently trying GD-Sharp and want to convert the graphics to a bitmap without saving it to an image file.

GD-Sharp method for saving to stream

bool GB.Save (outStream);

to save the stream using

using (FileStream fs = File.OpenWrite (@ "stream1.jpg")) 
{
 image.Save ((System.IO.Stream) fs);
 fs.Close ();
}

since bitmap supports stream, how does it convert GD-Sharp to Bitmap? thanks.

0


a source to share


2 answers


I did something like this.



MemoryStream memStream = new MemoryStream ();
gdimg.Save (memStream); 
Bitmap bmp2 = new Bitmap (memStream);
0


a source


You can use a MemoryStream, something like



gdsBitmap.Save(memStream);
memStream.Seek(0);
gdiBitmap = Bitmap.FromStream(memStream);

      

+2


a source







All Articles