Home > ASP.Net > Add Text to Upload Image

Add Text to Upload Image


try this example to Add Text to Uploaded Image and save it in folder in my website

Step1 :- create a website and add Upload folder and web page

Step2 :- in web page add fileupload and Button control

and in code behind :

protected void Button1_Click(object sender, EventArgs e)   
        System.Drawing.Image i = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);       
        Bitmap b = yaz(i, i.Width, i.Height, "Yasser Zaid", 16);        
        b.Save(Server.MapPath("~/Upload/" + FileUpload1.FileName));    

    private Bitmap yaz(System.Drawing.Image resim, int genislik, int yukseklik, string yazilacak, float font)   
        Bitmap resmim = new Bitmap(resim, genislik, yukseklik);       
        System.Drawing.Graphics graf = System.Drawing.Graphics.FromImage(resmim);       
        System.Drawing.SolidBrush firca = new SolidBrush(System.Drawing.Color.Red);       
        System.Drawing.Font fnt = new Font("calibri", font);  
        System.Drawing.SizeF size = new SizeF(0, 0);       
        System.Drawing.PointF coor = new PointF(0,0);       
        System.Drawing.RectangleF kutu = new RectangleF(coor, size);        
        StringFormat sf = new StringFormat();       
        sf.FormatFlags = StringFormatFlags.DirectionVertical;        
        graf.DrawString(yazilacak, fnt, firca, kutu, sf);       
        return resmim;   

Hope this helsp

Good Luck

Categories: ASP.Net
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: