How to add transparent visual text watermark in Visual Basic application using Bytescout.Watermarking SDK for .NET

This sample demonstrates how to add simple transparent text watermark to the image file using Bytescout.Watermarking SDK for .NET with Visual Basic.NET

Input image:

sample input image

Output image:

Sample output image with transparent text watermark added

 

Imports System.Diagnostics
Imports Bytescout.Watermarking
Imports Bytescout.Watermarking.Presets


Module Module1

    Sub Main()
	' Create new watermarker
        Dim waterMarker As New Watermarker()
	' Create new preset
        Dim preset As New TextFitsPage()
	' Create new string
        Dim inputFilePath As String
	' Create new string
        Dim outputFilePath As String

        ' Set input file path
        inputFilePath = "my_sample_image.jpg"
        ' Set output file path
        outputFilePath = "my_sample_output.jpg"

        ' Initialize library
        waterMarker.InitLibrary("demo", "demo")

        ' Add image to apply watermarks to
        waterMarker.AddInputFile(inputFilePath, outputFilePath)

        ' Set preset text
        preset.Text = "Bytescout Watermarking"

        ' Add watermark to watermarker
        waterMarker.AddWatermark(preset)

        ' Set output directory
        waterMarker.OutputOptions.OutputDirectory = "."

        ' Apply watermarks
        waterMarker.Execute()

        ' Open generated image file in default image viewer installed in Windows
        Process.Start(outputFilePath)

    End Sub

End Module

Download source code: watermarkingsdk_visual_basic_net.zip (240 KB)

You can also use EXIF macros to watermark images with their extended information. See this sample to view tutorial