Add text to a bitmap image using GDI+

June 4, 2011 - 13:11

Adding text to a bitmap requires you to first select the font to use and the colour of the brush to use. The example below loads in a .png file and adds the text "SOLD".

Dim newimage As bitmap
newimage = system.drawing.Image.FromFile(server.mappath("images/myimage.png"))

Dim gr As Graphics = Graphics.FromImage(newimage)
Dim myFontLabels as New Font("Arial", 10)
Dim myBrushLabels As New SolidBrush(Color.White)

gr.DrawString("SOLD",myFontLabels, myBrushLabels,10, 190) '# last 2 number are X and Y coords.



© 2011 simplevb.net