How To Add Watermark Text To Image In VB.NET

adding watermark text to image using , for sure i will say AWESOME , by the way i am not going to write a big tutorial with a lot functions i will just teach the basics then you can develop it as much as i know . you can add custom watermark text placer,font color,font,font size,save,etc so lets make it , open your visual basic 2008/2010 and make a new project and name it whatever you want and add two buttons and a textbox and a picturebox , click picturebox1 and properties > backgroundimagelayout > stretch . make your form look like what i have made up

my form size is 669, 363
picturebox1 size - 632, 275
textbox size -- 454, 20

change button text as given below

button1 - apply
button2 - browse

now double click your form and add these code

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim NF As New Font("Arial", 33, FontStyle.Bold)
   Dim NB As New SolidBrush(Color.FromArgb(64, 192, 255, 255))
        NB.Color = Color.FromArgb(128, 0, 0, 0)
        PictureBox1.CreateGraphics.DrawString(TextBox1.Text, NF, NB, 15, 135)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim openfiledialog As New OpenFileDialog
        If openfiledialog.ShowDialog = DialogResult.OK Then
            PictureBox1.Image = Image.FromFile(openfiledialog.FileName)
        End If
    End Sub
End Class
if you want to change the font just replace Arial with your font name and if you want to change the font size replace 33 with your font size and if you want to change the font style just replace Bold with your style(Italic,Regular,UnderLine,UnderScore)

now debug and click browse and select a image and you know what to do next

here is a image of mine watermark text to a picture with this app


Hello. How would you save this picture to your hard drive?



It will loose the graphics when you save it, as I said it's not that advance...! :)


Great information. Thanks for providing us such a useful information. Keep up the good work and continue providing us more quality information from time to time. Water Marking Software


Post a Comment

Note: Only a member of this blog may post a comment.