how to create a gif or png dynamicaly in .aspx and return in response?
Hi Daniel,
You can create a graphics from bmp on the fly and after modifying the
graphics obtained you can render it to Response.OutputStream.
This stream will be directly served to requesting browser. You can also
display this image on any HTML using standard <img> tag. Provide the web
accessible path of this image rendering page in src elemnet of the <img> tag
and your image will be shown with the HTML output by browser.
Sample code snippet:
<CODE>
Bitmap bmp = new Bitmap(200, 100);
Graphics gr = Graphics.FromImage(bmp);
gr.Clear(Color.WhiteSmoke);
gr.DrawString("Test String", new Font("Arial", 12), Brushes.Blue, 10, 10);
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
gr.Dispose();
bmp.Dispose();
Response.End();
</CODE>