Jump to content
Software FX Community

Background text in bitmap


SarahBenjamin

Recommended Posts

I am not sure if I understood your question correctly but to draw text on an existing image, you will have to create a graphics object with a new bitmap. You can try the following:

Rectangle

r = new Rectangle(10, 10, 300, 150);Image img = Image.FromFile("D:\\Beach.jpg");

Bitmap bmp = new Bitmap(300, 150);Graphics g = Graphics.FromImage((Image)bmp);

g.DrawImage(img, r);

g.DrawString("This is a test", new Font("Arial", 12, FontStyle.Bold), Brushes.Black, 15, 15,StringFormat.GenericTypographic);

g.Dispose();

Then if you have a picture box, for example, you can pass the new bitmap to it:

pictureBox1.Image = (

Image)bmp;
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...