Home

Bytescout.Watermarking
SDK for .NET

Click to view full size screenshot

Click to view full size screenshot

Bytescout.Watermarking SDK library for .NET

Download Free Trial Buy Now More Information

How to add transparent visual text watermark in ASP.NET web-application using Bytescout.Watermarking SDK for .NET

This sample demonstrates how to add simple transparent text watermark to the image file using Bytescout.Watermarking SDK for .NET with ASP.NET

Download source code: watermarkingsdk_asp_net.zip (240 KB)

Input image:

sample input image

Output image (as seen in browser):

Sample output image with transparent text watermark added

To use Bytescout.Watermarking.SDK in ASP.NET project just do the following:

1) Run Visual Studio 2005
2) Create new "Web-Site" project using Project Wizard
3) Click "Website" menu and then "Add Reference" command in this menu
4) "Add Reference" dialog will appear. Select "Bytescout.Watermarking.dll" and click OK to add a reference to Bytescout.Watermarking SDK component
5) Then copy and paste the following code into the "Default.aspx.cs" file (see below)

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Bytescout.Watermarking;
using Bytescout.Watermarking.Presets;

public partial class _Default : System.Web.UI.Page
{
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 = "my_sample_image.jpg";

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

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

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

// 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 output directory
waterMarker.OutputOptions.OutputStream = Response.OutputStream;
// Apply watermarks
waterMarker.Execute(0);

Response.End();
}
}

Download source code: watermarkingsdk_asp_net.zip (240 KB)

You can also use EXIF macros to watermark images with their extended information. See this sample to view tutorial

Download Free Trial Buy Now More Information

Documentation online: view (separate window)

First steps tutorials:

Tutorials (using different watermarking presets):

Advanced Tutorials (using presets with advanced settings):

Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement