예제 #1
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
            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);
        }
예제 #2
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
            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);
        }
        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();
        }
예제 #4
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();
        }
예제 #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);
        }
예제 #7
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();
        }
예제 #8
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);
        }
예제 #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);

            // 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);
        }
예제 #11
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
            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);
        }
예제 #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";

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

            // 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);
        }
예제 #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";
            // 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);
        }