Introduction
In today’s digital world, protecting visual content is more important than ever. Whether you are developing a photo management system, an e-commerce platform, or a document preview tool, applying a watermark to images helps safeguard them from unauthorized use.
In this article, you’ll learn how to add a watermark to an image in C# using the built-in System.Drawing namespace — without relying on third-party libraries.
What problem does this solve?
Prevents unauthorized reuse of images
Automatically adds branding to visual content
Supports batch watermark processing
Requires no external dependencies

How to Use
To apply a watermark to an image in C#, follow the structured approach below:
Step 1: Load the Source Image
Start by loading the image you want to protect.
You can use Image.FromFile() to read the file from disk into memory.
Step 2: Load the Watermark
Next, prepare the watermark image. It can be loaded in several ways:
Directly from a file on disk
From embedded project resources
From a
Stream(e.g., database or web upload)
This flexibility allows you to adapt the solution to different application scenarios.
Step 3: Adjust the Watermark Opacity
To control transparency, use a ColorMatrix and set the Matrix33 value.
This determines the alpha level of the watermark, allowing it to appear subtle rather than overpowering the original image.
Step 4: Draw the Watermark
Create a Graphics object from the original image and use Graphics.DrawImage() to overlay the watermark at the desired position.
Step 5: Save the Result
Finally, save the processed image using the Save() method.
This will generate a new file containing the original image with the applied watermark.
Key Method
public static void AddWatermarkToImage(
string originalImagePath,
System.Drawing.Image watermarkImage,
string outputImagePath,
float opacity = 0.3f)
Parameters
| Parameter | Type | Description |
|---|---|---|
| originalImagePath | string | Path to source image |
| watermarkImage | System.Drawing.Image | Watermark image object |
| outputImagePath | string | Path where the result image will be saved |
| opacity | float | Transparency level (0.0 – 1.0) |
Code Example
Below is a complete working example of adding a transparent watermark to an image in C#.
using System.Drawing;
using System.Drawing.Imaging;
public static class ImageWatermarkHelper
{
public static void AddWatermarkToImage(
string originalImagePath,
System.Drawing.Image watermarkImage,
string outputImagePath,
float opacity = 0.3f)
{
using (System.Drawing.Image originalImage = System.Drawing.Image.FromFile(originalImagePath))
using (Graphics graphics = Graphics.FromImage(originalImage))
{
// Create color matrix to control transparency
ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.Matrix33 = opacity; // Alpha channel
// Apply transparency settings
ImageAttributes imageAttributes = new ImageAttributes();
imageAttributes.SetColorMatrix(
colorMatrix,
ColorMatrixFlag.Default,
ColorAdjustType.Bitmap);
// Position watermark (bottom-right corner)
int padding = 10;
int xPosition = originalImage.Width - watermarkImage.Width - padding;
int yPosition = originalImage.Height - watermarkImage.Height - padding;
// Draw watermark on original image
graphics.DrawImage(
watermarkImage,
new Rectangle(xPosition, yPosition,
watermarkImage.Width,
watermarkImage.Height),
0,
0,
watermarkImage.Width,
watermarkImage.Height,
GraphicsUnit.Pixel,
imageAttributes);
// Save final image
originalImage.Save(outputImagePath);
}
}
}
Example Usage
using (System.Drawing.Image watermark = System.Drawing.Image.FromFile("watermark.png"))
{
ImageWatermarkHelper.AddWatermarkToImage(
"original.jpg",
watermark,
"protected.jpg",
0.5f);
}Conclusion
Adding a watermark to an image in C# is straightforward using System.Drawing, Graphics, and ColorMatrix. With just a few lines of code, you can control transparency, position the watermark dynamically, and save a protected image.

Marcin Szolke ScholkePosted Mar 15, 2026, 3:20 PM
If you want to know my philosophy, find me at https://lov111vol.com/about-marcin-scholke