My wife is making hand-crafted jewellery, bags and similar things (you can see her site Čarapica). One of the problems that we had was that when she placed the images of the things that she created on the internet it would sometimes be 'borrowed' by someone and used for some other purposes. In order to prevent that from happening we decided to add watermark to all images that we will be placing on her web site/facebook/online shop.
There might be some existing tools for doing something like that but since I'm a programmer I wanted to created such a utility by myself. Luckily enough it turned out I did not need to do any programming since there are tools such as ImageMagick which can be used for such a purpose. I've managed to make a working solution by using similar steps that I used when adding functionality to right click on file to add it to windows firewall.
There are several steps to achieve the desired functionality:
Download the ImageMagick package
Its best that you just download the zip package (you can find the version I used here and unpack it to the folder where your 'application' will be located. In my case I downloaded it into
Create a batch file that will perform the actual watermarking of an image
Here is the content of the
watermark.bat file which will be used to re-size the image:
c:\Apps\Watermark\convert -size 550x250 -background none -fill #FFFFFF50 -font "Segoe-UI" -pointsize 96 -rotate 25 label:%1 miff:- | c:\Apps\Watermark\composite -tile - "%~n2%~x2" miff:- | c:\Apps\Watermark\convert - -resize 1024x768 "%~n2_w%~x2"
The batch file does several things:
- It uses the
convert.exeutility to generate a label image which is slightly rotated and semitransparent (text defined by first parameter of the batch file)
- It pipes the newly created image to
composite.exeutility which takes the original image (defined by seconds parameter of the batch file) and adds the label image on top it
- The watermarked image is finally resized to 1024x768 and saved as original_w.extension. This final step can be omitted if you wish to resize the image - just remove the part
miff:- | c:\Apps\Watermark\convert - -resize 1024x768from the command
Here is an example of using the command
c:\Apps>c:\Apps\Watermark\watermark.bat "OP" a_view_from_Gradec.jpg on an image from Zagreb (the city where I live):
[onehalf half="1"]Original image: [/onehalf][onehalf half="2"]Final image: [/onehalf]
Enable right click on file to invoke our new batch file
This is relatively simple. We just need to enter a registry entry which will add a new option when you right click on the file. Inside the registry entry you need to define the actual text that will be used as a watermark. Here is the content of the
water-register.reg file which can be used to add necessary registry entry:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Watermark\command] @="cmd.exe /c c:\\Apps\\Watermark\\watermark.bat \"-your watermark text-\" \"%1\""
The drawback of the given registry file is that the right click context menu appears for every file type, not just executable. If somebody know how to make it appear for just image file then please send me a note (and no, just changing the registry from
HKEY_CLASSES_ROOT\.jpg or something similar does not do it :)).