Wednesday, August 03, 2005

Streaming images from memory

Well fellow .NET developers I thought you would find this article very helpful. Thanks Troy Tucker for the code snippet on getting the image to stream from memory:

ASP.NET: Create Snazzy Web Charts and Graphics On the Fly with the .NET Framework -- MSDN Magazine, February 2002: http://msdn.microsoft.com/msdnmag/issues/02/02/ASPDraw/ Article is awesome…
//NEW CODE for displaying IMAGE from MEMORY
MemoryStream myStream;
Byte[] imgByte = (Byte[])myCollection;

myStream = new MemoryStream(imgByte);
System.Drawing.Image _image = System.Drawing.Image.FromStream(myStream);

//System.Drawing.Image _newimage = _image.GetThumbnailImage(,, null, new System.IntPtr());
Response.ContentType = "image/jpeg"; //Make sure this is not jpg instead of jpeg!!!!!!!!!!
_image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.