Thursday, March 22, 2012

Why there is an error when using Bitmap.save(Response.StreamOutPut,ImageFormat.P

How to save png format to Response.OutPutStream?

Here's the error detail:
Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

Source Error:

Line 31:
Line 32: g.DrawString("Hi!",new Font ("Arial",23),new SolidBrush (Color.Blue ),3,3);
Line 33: bmp.Save (Response.OutputStream,ImageFormat.Png );
Line 34:
Line 35:I'm not sure if this is the answer, but here is some code I have that works.

Response.ContentType = "image/gif"
imgOutput.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)

0 comments:

Post a Comment