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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...