Monday, March 29, 2010

Response.write png

showing images in png format by streaming code snippet

Response.Clear();
MemoryStream MemStream = new MemoryStream();
Bitmap bitmap = new Bitmap(imagePath);
// set the content type
Response.ContentType = "image/png";
//send the image to the memory stream then output
bitmap.Save(MemStream, System.Drawing.Imaging.ImageFormat.Png);
MemStream.WriteTo(Response.OutputStream);
Response.Flush();
Response.End();



for details

No comments: