These source code samples are listed and grouped by their programming language and functions they use. ByteScout Watermarking SDK was made to help with resize image as fit within in C#. ByteScout Watermarking SDK is the software development kit that helps to quickly implement adding of watermarks on top of PNG, JPG, BMP images as well as on multipaged TIFF files. You may select ready to use presets or create your own preset with semitransparent logo images, text lines with adjustable font size, family, color, rotation.
Fast application programming interfaces of ByteScout Watermarking SDK for C# plus the instruction and the C# code below will help you quickly learn resize image as fit within. To do resize image as fit within in your C# project or application you may simply copy & paste the code and then run your app! Further enhancement of the code will make it more vigorous.
On our website you may get trial version of ByteScout Watermarking SDK for free. Source code samples are included to help you with your C# application.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
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);
// 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);
}
}
}
60 Day Free Trial or Visit ByteScout Watermarking SDK Home Page
Explore ByteScout Watermarking SDK Documentation
Explore Samples
Sign Up for ByteScout Watermarking SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Watermarking SDK Home Page
Explore ByteScout Watermarking SDK Documentation
Explore Samples
Sign Up for ByteScout Watermarking SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples