Let’s see today, how to add watermarks to images. This helps you brand your official photography, and protects your pictures from any unauthorized use. This article will guide you to programmatically add text and image watermarks to your image files using C#. In an earlier post, we have seen the same to add text and image-based watermarks to images using Java. After reading this article, it will not be difficult for you to add watermarks to JPG/JPEG, PNG, WebP, GIF, TIFF, JP2, BMP images using C# within your .NET application.
Let’s now separately see, how we can easily add text and image-based watermarks on your pictures, photos, or image files in C# using the .NET Watermarking API for documents and images.
Text and Image Watermarking API for .NET
GroupDocs.Watermark for .NET is an API for adding watermarks to the images or documents of different file formats within .NET applications. It provides effective watermarking methods that allow you to add text watermarks as well as image watermarks that are hard to get automatically removed by other third-party tools.
From the documentation, you may further check the features and supported file formats.
You can download the DLLs or MSI installer from the downloads section or get it from NuGet.
Add Text to Images as Watermark using C#
The API allows you to add text to images as a watermark with many customizations. The following steps guide how we can apply watermark on our images files, photos, or pictures using C# within the .NET application.
- Load the Image using Watermarker.
- Set the watermark text and style using TextWatermark.
- Set other watermark properties like position, rotation, opacity, etc.
- Add the text watermark to the image using the Add method.
- Save the output image with Save method.
The following C# code sample adds a text label on a JPG image as a watermark with some text rotation.
Insert Image Watermark to Images using C#
Similarly, we can also add another image as a watermark on our source image files. For this, use ImageWatermark class and its properties to customize the watermark appearance.
- Create Watermarker class object to load the source image.
- Prepare image watermark using ImageWatermark class.
- Set the watermark properties.
- Add the image watermark on the source image using Add method.
- Save the output image using Save method.
The following C# code sample adds a PNG image on another PNG file as a watermark on the preferred location.
I am confident that you can now easily add a watermark to your image files using C#. Even you can build your own .NET application that supports watermarking the documents and images of various file formats.
You can have a Free Temporary License to experience every aspect of the product. Free support will be happy to get you out of any confusion and resolve your watermark-related queries on the forum.