The following example demonstrates usage of Stamp class.

You can use the following predefined stamps (pass as a parameter into Stamp() contstructor 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";

            foreach (string stampType in Stamp.PresetImages)
            {
                // Set output file title
                string outputFilePath = "my_sample_output_" + stampType + ".jpg";

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

                // Set output directory
                waterMarker.OutputOptions.OutputDirectory = ".";

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

                // Set stamp type
                preset.ImageFile = stampType;

                // Add watermark to watermarker
                waterMarker.AddWatermark(preset);

                // Apply watermarks
                waterMarker.Execute();

                // Clear all settings
                waterMarker.Clear();
            }
        }
    }
}