View on GitHub

PngWatermarker

PNG watermarking library for .NET 4.5+

Download this project as a .zip file Download this project as a tar.gz file

PngWatermarker

PngWatermarker is a .NET 4.5+ library for the embedding and extraction of invisible watermarks on PNG files.

It makes use of the lovely pngcs library for decoding/encoding of the PNG files, the library was written by Hernán J. González, which is available here: https://code.google.com/p/pngcs/

Features

Watermark Types

Basic

Advanced

Examples

Text Watermark

PNGFile file = new PNGFile("MyOriginal.png");
TextWatermark mark = new TextWatermark("This is a text based watermark");

Watermarker.EmbedWatermark(file,mark,"password","MyOutput.png");

//Extraction

file = new PNGFile("MyOutput.png");
TextWatermark extract = (TextWatermark)Watermarker.ExtractWatermark(file,"password");

Composite Watermark

PNGFile file = new PNGFile("MyOriginal.png");

CompositeWatermark comp = new CompositeWatermark();
FileWatermark fileMark = new FileWatermark("MyFile.txt");
BinaryWatermark binMark = new BinaryWatermark(new byte[]{1,2,3,4});

comp.AddWatermark(fileMark);
comp.AddWatermark(binMark);

Watermarker.EmbedWatermark(file,comp,"password","MyOutput.png");

//Extraction
PNGFile file2 = new PNGFile("MyOutput.png");

CompositeWatermark extract = (CompositeWatermark)Watermarker.ExtractWatermark(file2,"password");
Watermark[] marks = extract.GetWatermarks();

Encrypted Watermark

PNGFile file = new PNGFile("MyOriginal.png");
RijndaelManaged aes = new RijndaelManaged();
aes.Padding = PaddingMode.Zeroes;
EncryptedWatermark.Algorithm = aes;
TextWatermark mark = new TextWatermark("This should be encrypted");
EncryptedWatermark encrypted = new EncryptedWatermark(mark, "super-secret");

Watermarker.EmbedWatermark(file, encrypted, "password", "MyOutput.png");

PNGFile file2 = new PNGFile("MyOutput.png");

EncryptedWatermark extract = Watermarker.ExtractWatermark(file2, "password");
extract.Decrypt("super-secret");

Watermark decrypted = extract.DecryptedMark;

Original File

Original File

File holding a watermark

Watermarked File