How to insert watermark to tiff file

How to insert watermark to tiff file

Issue : I want to insert gray watermark characters in a tiff file.

Tips : To watermark tiff image there can be used graphics object to draw exactly needed characters.

Example :

using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
// load an existing TIFF with Image.Load
using (var image = Aspose.Imaging.Image.Load(@"template.tiff"))
{
// create and initialize an instance of Graphics class and Initialize an object of SizeF to store image Size
var graphics = new Aspose.Imaging.Graphics(image);
var size = graphics.Image.Size;
// create an instance of Font. Initialize it with Font Face, Size and Style
var font = new Aspose.Imaging.Font("Times New Roman", 20, Aspose.Imaging.FontStyle.Bold);
// create an instance of SolidBrush and set Color & Opacity
var brush = new Aspose.Imaging.Brushes.SolidBrush();
brush.Color = Aspose.Imaging.Color.Red;
brush.Opacity = 0;
// initialize an object of StringFormat class and set its various properties
var format = new Aspose.Imaging.StringFormat();
format.Alignment = Aspose.Imaging.StringAlignment.Center;
format.FormatFlags = Aspose.Imaging.StringFormatFlags.MeasureTrailingSpaces;
// draw the string on image
graphics.DrawString("CONFIDENTIAL", font, brush, 0, 0, format);
// save output to disc
image.Save(@"output.tiff");
}