PDNWatermark: Creating watermarks

This tutorial will guide you through the process of creating watermarks for the PDNWatermark plugin (which is deprecated) for Paint.NET.

Note: This tutorial probably won't work with Notepad, I personally use Notepad++.

Watermarks are basically XML documents, so firstly, create a new XML document, specifying the encoding as ISO8859-1, in the Watermarks subdirectory of Paint.NET user files. Then create a components tag pair - the rest of the code will go inside this pair.

Adding text

Each watermark must contain one or more components which can be either images or text - each of these can be positioned relative to two corners and be resized by width and height. Inside that add a text tag pair - this adds a text component to the watermark. Inside the text tag add a value tag, inside this write the text you wish to appear in the watermark. The placeholders {UserName} and {DateYear} will be dynamically replaced with the logged-in username and the date.

Adding images

It is also possible to add images as components, to do this add another component, this time using the image tag. To actually add the image you firstly need to encode your image to base64, here is an online service to do that. Now create a value tag like you did in the previous step, but this time paste the base64 string into it.

Positioning

I have now shown you how to add both text and image components to your watermark, but a watermark that always stays in the top-right hand corner of an image is rather useless.

To position a component you can use the <left>, <right>, <top> and <bottom> tags according to which side of the screen you wish to position your component relative to. Inside each tag place a single integer representing a single coordinate. You can also change the width and height of both text and images with the <width and <height tags.

Adding <percent /> to a component will make the positioning tags mentioned above measure by percentage instead of pixels.

More on Text

The appearance of text can be further customised using additional tags mentioned in this section. Note that none of the tags introduced in this section are affected by the percentage tag.

While the width and height tags can be used to resize a text component, the <fontsize> tag can be used to change what size it is drawn in initially. While the default font used is MS Sans Serif, this can be changed to another TrueType font with the <font> tag.

Although the default font colour is white, this can be customised by setting each of the <red>, <green> and <blue> tags to a number between zero and 255.



Copyright (C) Simon Brown 2009 - 2024. All rights reserved. Icons by Yusuke Kamiyamane.