Here are some quick and dirty instructions for creating a "stamp", and then using it for adding "watermarks" to existing images. I'll use ImageMagick 5.5.7, and use PNG files for making the stamp, and JPEG files for original and watermarked images.
I started with a simple hand-made figure (my initials). I wanted to get a fairly small stamp, so the origial drawing is about 2cm x 2cm in size (or a bit less). My goal was to have a ~250x250 pixel stamp that has some white space around the drawing. So, I made a drawing, and then set the scanner to grayscale, 300DPI, and 200x200 pixels size selection. After scanning, I converted the TIF to PNG using:
% convert -quality 9 scan.tif scan.png
Checking the image size with
% identify scan.png scan.png PNG 200x200+0+0 PseudoClass 256c 8-bit 15.4kb 0.030u 0:01
Therefore, I needed to add some whitespace around it to make it, say 256x256. I chose to create a proper sized, white image, and then place my scan in the center:
% convert -size 256x256 xc:white base.png % composite -gravity center scan.png base.png mark1.png
Our scanned image has some noise in it, and a simple stamp would be monochrome: only the figure as black, and all surrounding areas as transparent. I chose to do the following:
% convert -monochrome mark1.png mark2.png or % convert -monochrome -threshold 70%,70%,70% mark1.png mark2.png
One could also try segmenting the image:
% convert -segment 1x1 mark1.png mark3.png % convert -monochrome mark3.png mark2.png
The monochrome image is then converted to stamp with transparent background:
% convert -transparent white mark2.png mark3.png
Note how the edge of the drawing is not well defined, and the drawing has some "holes" in it, as well. This only makes the stamp more unique. One could clean it up in some image editing program, but we'll leave it as it is for now.
Our simple stamp is now ready to be used, but it has a problem: what if the original image is black, or almost black? Our stamp will not be visible. No matter what color our stamp would be, it would always disappear in an image with mostly the same color.
To combat this problem, we'll create a grayscale stamp with noise in it. So, the stamp will have all shades of gray, making any subset of those stamp pixels visible (white pixels will show up on black images, etc).
First, we need to create an image with proper noise in it. Since adding noise will also add color, I'll start by creating a simple grayscale image that can be used as a color map:
% convert -size 256x256 -colors 256 gradient:black-white map.png
Then I'll create another image, now with noise (you can use any of the following as noise type: Uniform, Gaussian, Impulse, Laplacian):
% convert -size 256x256 xc:white base.png % convert base.png +noise Impulse -normalize -map map.png noise.png
Finally, I'll combine the noise with my stamp:
% composite -dissolve 100% noise.png mark3.png miff:- | composite -compose CopyOpacity mark3.png - watermark.png
And make sure the image has the whole grayscale in use:
% convert watermark.png -normalize watermark.png
We can use the watermark quite simply:
% composite -dissolve 15 -tile watermark.png src.jpg dst.jpg