public static void Run()
{
// ExStart:AddWatermarkToImage
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();
// Create an instance of Image and load an existing image
using (Image image = Image.Load(dataDir + "WaterMark.bmp"))
{
// Create and initialize an instance of Graphics class
Graphics graphics = new Graphics(image);
// Creates an instance of Font
Font font = new Font("Times New Roman", 16, FontStyle.Bold);
// Create an instance of SolidBrush and set its various properties
SolidBrush brush = new SolidBrush();
brush.Color = Color.Black;
brush.Opacity = 100;
// Draw a String using the SolidBrush object and Font, at specific Point and Save the image with changes.
graphics.DrawString("Aspose.Imaging for .Net", font, brush, new PointF(image.Width / 2, image.Height / 2));
image.Save(dataDir + "AddWatermarkToImage_out.bmp");
// ExStart:AddWatermarkToImage
// Display Status.
Console.WriteLine("Watermark added successfully.");
}
}
}