QUESTIONS OR COMMENTS ABOUT PRODUCTS? WRITE US AT SUPPORT@BYTESCOUT.COM OR USE THIS FORM

How to add a a red colored text caption to the image in Visual Basic.NET application without any 3rd party components or libraries

Tutorial: how to add watermark to a picture using built-in .NET functionality

 
 



Looking for a component to add watermarks based on ready-to-use presets?

Check Bytescout.Watermarking SDK for .NET to add more attractive watermarks with ready-to-use customizable presets

This tutorial demonstrates how to add a red text (watermark) to a photo file using .NET built-in functionality without any 3rd party components and libraries (like our Watermarking SDK) in Visual Basic.NET

Download source code for this example: HowToAddWatermarkToImageInDotNetWithout3rdPartyTools_vb.zip (300 KB)

Input image:

sample input image

Output image:

output image

Imports System.Diagnostics

Imports System.Drawing

Module Module1

Sub Main()

Dim image As Image

Dim graphics As Graphics

Dim font As Font

Dim point As PointF

' Load image

image = Drawing.Image.FromFile("my_sample_image.jpg")

' Create graphics from image

graphics = Drawing.Graphics.FromImage(image)

' Create font

font = New Font("Times New Roman", 42.0F)

' Create text position

point = New PointF(150, 150)

' Draw text

Graphics.DrawString("Watermark", Font, Brushes.Red, Point)

' Save image

image.Save("my_sample_output.jpg")

' Open generated image file in default image viewer installed in Windows

Process.Start("my_sample_output.jpg")

End Sub

End Module

Download source code for this example: HowToAddWatermarkToImageInDotNetWithout3rdPartyTools_vb.zip (300 KB)

Tutorials: