Example #1
0
        static void Main(string[] args)
        {
            // Create Watermarker instance
            Watermarker waterMarker = new Watermarker();

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

            // Add images to apply watermarks to
            waterMarker.AddInputFile("my_sample_image2.jpg", "my_sample_image2_output.jpg");
            waterMarker.AddInputFile("my_sample_image3.jpg", "my_sample_image3_output.jpg");

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

            // Set watermark text
            preset.Text = "Bytescout Watermarking";

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


            // Apply watermarks
            waterMarker.Execute();
        }
Example #2
0
        static void Main(string[] args)
        {
            // Create Watermarker instance
            Watermarker waterMarker = new Watermarker();

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

            // Add images to apply watermarks to
            waterMarker.AddInputFile("image1.jpg", "image1_watermarked.jpg");
            waterMarker.AddInputFile("image2.jpg", "image2_watermarked.jpg");
            waterMarker.AddInputFile("image3.jpg", "image3_watermarked.jpg");

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

            // Set watermark text
            preset.Text = "My Watermark (c) Me 2010";

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

            // Add Progress event handler
            waterMarker.Progress += new ProgressEventHandler(waterMarker_Progress);

            // Apply watermarks
            waterMarker.Execute();

            Console.WriteLine();
            Console.WriteLine("Hit any key...");
            Console.ReadKey();
        }
        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
            StampFitsPageDiagonal preset = new StampFitsPageDiagonal();

            // 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);
        }
        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
            DateAndTime preset = new DateAndTime();

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

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

            // Set output format
            waterMarker.OutputOptions.ImageFormat = OutputFormats.JPEG;

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
Example #5
0
        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
            LogoWithText preset = new LogoWithText();

            // Select image file
            preset.ImageFile = "mylogo.png";

            // Set text transparency
            preset.Transparency = 40;

            // Set watermark placement
            preset.Placement = WatermarkPlacement.MiddleCenter;

            // Set text
            preset.Text = "Bytescout Watermarking";

            // Set text location
            preset.TextLocation = TextLocation.Bottom;

            // Set text color
            preset.TextColor = Color.Black;

            // Set text Alignment
            preset.TextAlignment = TextAlignment.Center;

            // Set text font
            preset.Font = new WatermarkFont("Tahoma", FontStyle.Regular, FontSizeType.Points, 20);

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

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

            // Set output format
            waterMarker.OutputOptions.ImageFormat = OutputFormats.JPEG;

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
        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
            TextAnnotation preset = new TextAnnotation();

            // Set radius of the corners of the rectangle
            preset.Radius = 30;

            // Set text color
            preset.TextColor = Color.Black;

            // Set annotation background color
            preset.BackgroundColor = Color.White;

            // Set annotation background transparency
            preset.BackgroundTransparency = 40;

            // Set text
            preset.Text = "Bytescout Watermarking";

            // Set watermark font
            preset.Font = new WatermarkFont("Tahoma", FontStyle.Regular, FontSizeType.Points, 25);

            // Set watermark placement
            preset.Placement = WatermarkPlacement.MiddleCenter;

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

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

            // Set output format
            waterMarker.OutputOptions.ImageFormat = OutputFormats.JPEG;

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
Example #7
0
        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
            TextAnnotation preset = new TextAnnotation();

            // Set text with macros
            // complete list of available macros please see in the SDK documentation
            preset.Text = @"Date Time: {{LOCAL_DATE_LONG}} {{LOCAL_TIME}} " +
                          "\nFilename: {{FILENAME}}\n" +
                          "Manufacturer: {{EXIF_EQUIPMENT_MANUFACTURER}}\n" +
                          "Model: {{EXIF_EQUIPMENT_MODEL}}\n" +
                          "Software: {{EXIF_SOFTWARE_USED}}\n" +
                          "Date/Time: {{EXIF_ORIGINAL_DATE}}\n" +
                          "Exposure Time: {{EXIF_EXPOSURE_TIME}} sec\n" +
                          "Exposure Program: {{EXIF_EXPOSURE_PROGRAM}}\n" +
                          "Exposure Bias: {{EXIF_EXPOSURE_BIAS}} EV\n" +
                          "F Number: F {{EXIF_F_NUMBER}}\n" +
                          "ISO Speed Rating: ISO {{EXIF_ISO_SPEED}}\n" +
                          "Flash: {{EXIF_FLASH}}\n" +
                          "Focal Length: {{EXIF_FOCAL_LENGTH}} mm\n" +
                          "Metering Mode: {{EXIF_METERING_MODE}}";


            // Set watermark font
            preset.Font = new WatermarkFont("Tahoma", FontStyle.Regular, FontSizeType.Percents, 2); // set font size to 2% of the image size

            waterMarker.OutputOptions.OutputDirectory = ".";
            // Add watermark to watermarker
            waterMarker.AddWatermark(preset);

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create Watermarker instance
            Watermarker waterMarker = new Watermarker();

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

            // Set input file name
            string inputFilePath = MapPath("my_sample_image.jpg");

            // Create sample input stream
            Stream inputStream = new FileStream(inputFilePath, FileMode.Open);
            // Create image from stream
            Image image = new Bitmap(inputStream);

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

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

            preset.Text         = "Bytescout Watermarking";
            preset.TextColor    = Color.Aqua;
            preset.Transparency = 25;

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

            // Clear http output
            Response.Clear();
            // Set the content type to JPEG
            Response.ContentType = "image/jpeg";
            // Add content type header
            Response.AddHeader("Content-Type", "image/jpeg");
            // Set the content disposition
            Response.AddHeader("Content-Disposition", "inline;filename=my_sample_image.jpg");

            // Set Response.OutputStream as result image destination
            waterMarker.OutputOptions.OutputStream = Response.OutputStream;

            // Execute watermarking
            waterMarker.Execute(0);

            // Cleanup
            image.Dispose();
            inputStream.Dispose();

            Response.End();
        }
Example #9
0
        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
            TextFitsPageDiagonal preset = new TextFitsPageDiagonal();

            // Set watermark text
            preset.Text = "Bytescout Watermarking";

            // Set watermark font
            preset.Font = new WatermarkFont("Tahoma", FontStyle.Regular, FontSizeType.Points, 30);

            // Set watermark text color
            preset.TextColor = Color.Black;

            // Set text transparency
            preset.Transparency = 40;

            // Set watermark orientation
            preset.Orientation = DiagonalOrientation.FromTopLeftToBottomRight;

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

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

            // Set output format
            waterMarker.OutputOptions.ImageFormat = OutputFormats.JPEG;

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
        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);

            // Allow resize
            waterMarker.OutputOptions.Resize = true;

            // Allow to enlarge image
            waterMarker.OutputOptions.DontEnlargeSmallImages = false;

            // Set resize type to pixels
            waterMarker.OutputOptions.ResizeType = ResizeType.Pixels;

            // Fit to width
            waterMarker.OutputOptions.ResizeFitWithin = FitWithin.WidthOnly;

            // Set width
            waterMarker.OutputOptions.ResizeWidthInPixels = 600;

            // Set height
            waterMarker.OutputOptions.ResizeHeightInPixels = 20;


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


            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
        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
            LogoImage preset = new LogoImage();

            // Select image file
            preset.ImageFile = "mylogo.png";

            // Set text transparency
            preset.Transparency = 40;

            // Set watermark placement
            preset.Placement = WatermarkPlacement.MiddleCenter;

            // Set scale
            preset.Scale = 2.0f;

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

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

            // Set output format
            waterMarker.OutputOptions.ImageFormat = OutputFormats.JPEG;

            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
Example #12
0
        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);


            // Allow resize
            waterMarker.OutputOptions.Resize = true;

            // Set resize type to percentage
            waterMarker.OutputOptions.ResizeType = ResizeType.Actual;

            // Set units type
            waterMarker.OutputOptions.ResizeActualUnits = ActualSizeUnits.inches;

            // Set image width
            waterMarker.OutputOptions.ResizeWidthInUnits = 1.5f;

            // Set image height
            waterMarker.OutputOptions.ResizeHeightInUnits = 2.0f;

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

            // Apply watermarks
            waterMarker.Execute();


            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
        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
            TiledTextDiagonal preset = new TiledTextDiagonal();

            // Set text
            preset.Text = "Sample watermark text";

            // Set font size
            preset.Font.Style = FontStyle.Bold;
            preset.Font.Size  = 3;

            preset.Transparency = 15;

            // 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);
        }
Example #14
0
        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();
            }
        }
        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);


            // Allow resize
            waterMarker.OutputOptions.Resize = true;

            // Set resize type to percentage
            waterMarker.OutputOptions.ResizeType = ResizeType.Percentage;

            // Reduce image by 1/2
            waterMarker.OutputOptions.ResizePercentage = 50;

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


            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
        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);

            // Allow to override resolution
            waterMarker.OutputOptions.OverrideResolution = true;

            // Set vertical resolution
            waterMarker.OutputOptions.VerticalResolution = 300;

            // Set horizontal resolution
            waterMarker.OutputOptions.HorizontalResolution = 300;


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


            // Apply watermarks
            waterMarker.Execute();

            // open generated image file in default image viewer installed in Windows
            Process.Start(outputFilePath);
        }
        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
            LogoWithText preset = new LogoWithText();

            // Select image file
            preset.ImageFile = "mylogo.png";

            // Set 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);
        }
        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
            SimpleText preset = new SimpleText();

            // Set watermark text
            preset.Text = "Bytescout Watermarking";

            // Set watermark font
            preset.Font = new WatermarkFont("Tahoma", FontStyle.Regular, FontSizeType.Points, 30);

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