How to display image on a browser without using the image tag

Platform: ASP.NET| Category: GDI+

VB.NET

Dim objBitmap As New Bitmap(500, 500)
Dim objGraphics As Graphics = Graphics.FromImage(objBitmap)
objGraphics.Clear(Color.White)
objGraphics.FillRectangle(New SolidBrush(Color.Purple), 0, 0, 400, 10)
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg)

C#

Bitmap objBitmap = new Bitmap(500, 500);
Graphics objGraphics = Graphics.FromImage(objBitmap); 
objGraphics.Clear(Color.White);
objGraphics.FillRectangle(new SolidBrush(Color.Purple  ), 0, 0, 400, 10);
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.