Click here to Skip to main content
15,792,397 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Every body,
here is something to add text in an image. The problem is the image file size is changed when I saves the image on harddisk. can someone guide me how I can add text in an image with transperent background.
here it goes
public static Bitmap   insertTextInImage(string Path,string Text)
    Bitmap myBitmap = new Bitmap(Path);
    Graphics g = Graphics.FromImage(myBitmap);
    StringFormat strFormat = new StringFormat();
    strFormat.Alignment = StringAlignment.Center;
    g.DrawString(Text, new Font("Tahoma", 10), Brushes.Black ,
        new RectangleF(0, 0, 140, 50), strFormat);

    return myBitmap;
Updated 18-Apr-10 8:02am

1 solution

I think that you are looking for Water-marking on an image. You can try these:
1. Creating a Watermarked Photograph with GDI+ for .NET[^]
2. Build a simple watermarking utility in C#[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900