The following example demonstrates usage of StampFitsPage class.

You can use the following predefined stamps (pass as a parameter into StampFitsPage() constructor to use the predefined stamp). To set the color of the stamp please use .ColorizeByColor function

  • [APPROVED] - APPROVED stamp

  • [CENSORED] - CENSORED stamp

  • [CERTIFIED] - CERTIFIED stamp

  • [COPY] - COPY stamp

  • [COPYRIGHTED] - COPYRIGHTED stamp

  • [DEMO] - DEMO stamp

  • [DONOTCOPY] - DO NOT COPY stamp

  • [DRAFT] - DRAFT stamp

  • [EXAMPLE] - EXAMPLE stamp

  • [ORIGINAL] - ORIGINAL stamp

  • [PREVIEW] - PREVIEW stamp

  • [PRIVATE] - PRIVATE stamp

  • [PROTECTED] - PROTECTED stamp

  • [SAMPLE] - SAMPLE stamp

  Copy Code
        
using System;
using System.Diagnostics;
using System.Drawing;
using System.Collections.Generic;
using Bytescout.Watermarking;
using Bytescout.Watermarking.Presets;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create Watermarker instance
            Watermarker waterMarker = new Watermarker();

            // Initialize library
            waterMarker.InitLibrary("demo", "demo");

            // Set input file name
            string inputFilePath = "my_sample_image.jpg";
            // Set output file title
            string outputFilePath = "my_sample_output.jpg";

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

            // Create new watermark
            StampFitsPage preset = new StampFitsPage();

            // Set stamp type
            preset.ImageFile = "[APPROVED]";

            // 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);
        }
    }
}