first create Class File:
private void CreateImage() 
        {
            this.canvas = new Bitmap(this.height,this.width);
            using (Graphics g = Graphics.FromImage(this.canvas)) 
            {
                g.Clear(Color.White);
                g.DrawImage(((HeaderImage) new HeaderImage(this.headercolor,this.messageone,this.width,0)).IMAGE,0,0);
                g.DrawImage(((HeaderImageWithIcon) new HeaderImageWithIcon(this.headercolor,this.messagetwo,this.width,25)).IMAGE,0,50);
            
                g.DrawString(messagemain, new Font("Verdana",10,FontStyle.Bold),new SolidBrush(Color.Black),0,100, new System.Drawing.StringFormat());
        
            }
        }
     
        public class HeaderImage
        {
            private int height = 30;
            private int width = 700;
            private int messageoffset = 0;
            private Bitmap bmp;
            private string message;
            protected Graphics g;
            protected Color barcolour = Color.Gray;
            protected Rectangle rct;
          
            public Bitmap IMAGE 
            {
                get 
                {
                    return this.bmp;
                }
            }
            
           
public HeaderImage(Color barcolour,string message,int width,int messageoffset) 
            {
            
                this.width = width;
                this.barcolour = barcolour;
                this.message = message;
                this.bmp = new System.Drawing.Bitmap(width, height, PixelFormat.Format16bppRgb555);
                this.messageoffset = messageoffset;
                this.DrawBar();    
           
            }
protected virtual void DrawBar() 
            {
                this.g = Graphics.FromImage(this.bmp);
                this.g.SmoothingMode = SmoothingMode.AntiAlias;
                this.g.Clear(Color.White); 
                this.rct = new Rectangle(new Point(0,0), new Size(width,bmp.Height-3));
            
                Pen p = new Pen(this.barcolour,3);
                this.g.DrawRectangle(p,rct);
                    
                this.g.FillRectangle(new LinearGradientBrush(rct, this.barcolour, Color.FromArgb(255,255,255),LinearGradientMode.Vertical),0,0,bmp.Width-1,bmp.Height-1);
                this.g.DrawString(this.message, new Font("Verdana",10,FontStyle.Bold),new SolidBrush(this.barcolour),3+this.messageoffset,5, new System.Drawing.StringFormat());
            }
        }
        
        public class HeaderImageWithIcon : HeaderImage 
        {
       
            private string imagepath = @"c:\temp\paper.gif";
                        
            public HeaderImageWithIcon(string message) : this(Color.Gray,message)
            {
                
            }
        
            public HeaderImageWithIcon(Color barcolour,string message) : this(barcolour,message,700)
            {
                
            }
            public HeaderImageWithIcon(Color barcolour,string message,int width) : base(barcolour,message,width,0)
            {
                                
            }
            public HeaderImageWithIcon(Color barcolour,string message,int width,int messageoffset) : base(barcolour,message,width,messageoffset)
            {
                                
            }
       
            protected override void DrawBar()
            {
                                
                base.DrawBar();
                Bitmap pic = (Bitmap) Image.FromFile(imagepath);
                pic.MakeTransparent(Color.Black);
                base.g.DrawImage(pic,1,3,pic.Width,pic.Height);
            }
                    
        }
in aspx file:
<form id=Form1 method=post runat="server"> <asp:label id=Label2 style="Z-INDEX: 105; LEFT: 112px; POSITION: absolute; TOP: 56px" runat="server" Width="144px" Height="24px" Font-Names="Verdana" Font-Size="X-Small">First Header Text:</asp:label><asp:textbox id=txtTwo style="Z-INDEX: 103; LEFT: 288px; POSITION: absolute; TOP: 80px" runat="server" Width="352px" Font-Names="Verdana">My 2nd heading</asp:textbox><INPUT style="Z-INDEX: 101; LEFT: 544px; WIDTH: 96px; POSITION: absolute; TOP: 104px; HEIGHT: 24px" type=submit value=Submit> 
<asp:textbox id=txtOne style="Z-INDEX: 102; LEFT: 288px; POSITION: absolute; TOP: 56px" runat="server" Width="352px" Font-Names="Verdana">My 1st Heading</asp:textbox><asp:label id=Label1 style="Z-INDEX: 104; LEFT: 112px; POSITION: absolute; TOP: 80px" runat="server" Width="152px" Height="24px" Font-Names="Verdana" Font-Size="X-Small">Second Header Text:</asp:label></form>
in code behind File:
if (IsPostBack) 
            {
    
                if (Request.Params["colour"] != null && Request.Params["height"] != null && Request.Params["width"] != null) 
                {
            
                    this.ci = new CompleteImage(Color.FromName(Request.Params["colour"]),this.txtOne.Text,this.txtTwo.Text,DateTime.Now.ToString(),Convert.ToInt32(Request.Params["height"]),Convert.ToInt32(Request.Params["width"]));
                                    
                } 
                else 
                {
                    this.ci    = new CompleteImage(this.txtOne.Text,this.txtTwo.Text,DateTime.Now.ToString());
                }
                Response.ContentType = "image/jpeg";
                 
                this.ci.CANVAS.Save(Response.OutputStream, ImageFormat.Jpeg);  
}
}
please Comment on this