Visual Watermarking


In the physical world watermarking did prove to be a very important tool. May that be for money where it is used to verify the authenticity or may that be for corporate letters where it is both, security and style.
So it is not surprising that watermarking did also take it's way into the computer world and also onto the internet. A world where copying and ignoring copyrights is unfortunately very common. Here two different views of a watermarks did appear:
  • Visual Watermarks.
  • Invisible Watermarks.
These two forms serve very different purposes. Let's start with Invisible Watermarks.

Invisible Watermarks

This form of watermarks is as the name suggests invisible. Well almost actually. Invisible watermarking is used to plant copyright information into different media. Then if a dispute over that piece of work starts one can check the watermark to find the true owner. These watermarks are closely related to steganography.
Just as in steganography one plants secret information into a file where a human won't notice it. Like small distortions in an audio file or a one pixel difference in a picture.
Just like in steganographic efforts you face the same problems here that the distortions might be easily discovered by a program if applied wrong.
However there are even more problems concerning invisible watermarks. Robustness. A watermark should survive picture modifications. It should also be there in small subparts of a picture. It has to survive the application of a second watermark. In the optimal case it should even be there when you print the picture and then scan it.
These are all very hard tasks and by far not solved.

Visual Watermarks

This type of watermarks can only serve very limited as a check function. However they are very well suited to protect pictures up front. You cannot really claim that a picture belongs to you when there is a big fat watermark of an other person on it, can you?
One problem still remains: How to protect the watermark from being removed.
Here my work on the topic started. How to design a watermark that cannot be removed or can only be removed very very hard. I also did some work on how to remove watermarks illegally. Worked pretty well for the more straight forward ones and especially for color pictures, but failed pretty hard with difficult watermarks. An other student then tried to remove my watermarks shown below as his master thesis. I don't know if he ever finished it however.
But back to the application of watermarks...

Classic Visual Watermarks

The classic visual watermark works applying a black and white watermark to a grayscale picture like these two:


Then to generate the watermark you put both pictures over each other. At every point where the mask is white you add or subtract a given value from the picture. The next to pictures show a +40 and a -40 watermark.


Pretty, aren't they?
You might notice a small difference in the non watermarked part of the picture however. Why is this so one might ask. Well simply. If you got 255 as the maximum gray value and I add 40 I have got a problem. Now there are several ways to solve it. In the above examples I did lighten up or darken down the picture so that he watermark always fits.
Of course there are also other methods. Here are the 3 possibilities I did implement:


The fist one is the darkening of the whole picture again. The second variant just sets all values >255 to 255. It does not distort the picture, but as one can see the watermark cannot be seen very well on bright spots. Lastly there is the modulo algorithm. All values bigger then 255 are set to value-255. Looks pretty bad for the eye, no? But this method will prove very valuable for HSV color watermarks shown below. Also it is the only watermarking type that is reversible. If you got the mask and the value you can completely eliminate the watermark. Pretty useful if you look into a licensing key.

Breaking Classic Watermarks

Breaking these watermarks is astoundingly easily. Especially the darkening type. There are two steps how this is done. First you have to find out how big the apply factor was. This can be done quite easily with a histogram. There you will see a spike at the watermark factor. Now all you need is a good edge detector applied at that histogram part and you are basically there. I said basically as in reality this can still be pretty hard. It gets even harder if the applied value is close to 0 as it is very hard to find then in the natural disturbance. Still note this watermark is breakable and so one needs a different method of watermarking.

Advanced Classic Watermarks

To prevent this attack the histographic analysis has to be prevented. Again I can offer several methods


The fist picture is once again the old plain watermark. The second one shows a slightly different approach. Here a random value is applied. In this case +30 to +90. This certainly won't give a histogram peak, will it? Indeed. But you can now 'easily' remove the watermark by just looking at parts of the picture with high noise. Also not that good idea. So there are methods 3 and 4. Adaptive watermarks...
Just like the random watermarks you pick a value range instead of one value here. But this time you take the picture as the random seed instead of a real random number.
In example 3 a value of 30 is applied if the source pixel is 'white' and a 90 if the source pixel is 'black'. All other values are interpolated. Example 4 is just the other way around. A 90 for white and a 30 for black. Both methods give good results in masking itself against the histogram attack. These very examples would be easy to break however as the factor is way too high - don't forget that.

General Classic Watermarks

As a final work I did also try a more general approach to watermarks. Look at these two pictures. Both are done with a constant 60 watermark:


See the difference? The second picture is way harder to break. But why does it look like that? Because I implemented a new mask definition. The mask looks like this:

Only the white parts of the grayscale mask are now really done at 60. The gray parts are done at about 30 and so on. With this method of grayscale masks combined with adaptive watermarking a picture is very secure.

Color Pictures

Ever since I heard about visual watermarking I wanted to do color pictures as well. Shouldn't be much different, but more universal...
Indeed you can do visual watermarking in color straight forward like this collection of pictures


You can either only use one color channel (red, green, blue) or you can use all of them. Of course you could also use two combined. Doesn't change much.

Alternatively I also did some other color schemes then RGB like the CYM one...


In principle these are the mixtures of 2 colors mentioned above. My teacher later encouraged me to use a more sophisticated approach on color channels. The one used by JPEG or MPEG. Here the 'colors' are divided into luminescence and two chroma channels.


The idea here was to mainly use the luminescence channel as it should only change the 'brightness' of the portion and so work very similar to the grayscale watermarks. It pretty much does this as you can see, but it leaves a light green shimmer.

So I did one more try with yet a different color model. The HSV one. This color model separates a pixel into the color information, the intensity and the black part. Using this model you get these results:


3 very interesting effects, aren't they? The changed color value looks very strong in the human eye. Mathematically it is however very hard to detect. Also this watermark if used together with the reversible method mentioned above (see Classic Visual Watermarks) provides a very good reversible solution. It is the only watermark that is naturally cyclic.
The second one, the intensity changing watermark is also very interesting. This one does pretty much exactly what a human would do. It seems to just lighten up or darken all channels smoothly. Much like the luminescence one, but without the green distortion.
Finally the third channel. Also looks interesting, doesn't it? It transforms the part of the picture into a grayscale one. Obviously this one cannot be restored at all if used at 255 strength. One would have to guess the original color. However if you transform the complete picture into grayscale the watermark is gone. So use that one with caution and only of the color is a vital part of the picture.

Breaking Color Pictures

Not much that hasn't already be said about grayscale pictures can be added here. Just split the picture into the appropriate color channels and break each one separately. However... Breaking is more easy. Either a watermark is applied onto all 3 channels. Then you can add the possible watermarks you found on the channels to verify detection. If it is only applied to 1 channel you can do the opposite. You can filter out most of the pictures natural edges and so find the watermark ones easier. So it is even more vital to use the maximal possible security when watermarking - low watermarking value per se and different/smooth watermark values.
I did one such watermark below (also the value is too high so that you can see better).


Here I did watermark all 3 channels, but I did it on different places and same places. So very few info can be derived from the combination. Also as you can see the mask is very very blurry. Not much luck detecting sharp edges here, no? This watermark is not 100% secure, but it is close. I've yet to see a program that can remove it.

Finally here is my visual watermarking program, MKMARK. All watermarks on this page have been done with it. Note that it only works with PBM, PGM and PPM file formats. You might need to install a proper conversion package to that file formats. Also in the Windows world Paint Shop Pro does support these formats.
Usage of MKMARK

MKMARK v.5.2            by CFF-Soft

Usage: MKMARK picturefile maskfile type-of-maskfile color-model targetfile
       type-of-target preprocessing from to marking-method preprocessing
       from to marking-method preprocessing from to marking-method
picturefile     : file in p?m-ascii or pgm,ppm-raw format (P1,P2,P3,P5,P6)
maskfile        : file in p?m-ascii or pgm,ppm-raw format (P1,P2,P3,P5,P6)
                  the file contains the mask of the area to be watermarked
                  Red parts affect the 1st channel, green parts the 2nd and
                  blue ones the 3rd color channel (see color-model)
type-of-maskfile: 0 ... a bright color results in a strong watermark
                  1 ... a dark color results in a strong watermark
color-model     : 0 ... RGB
                  1 ... CMY
                  2 ... HSV
                  3 ... YUV
targetfile      : file where the marked image is saved in.
                  file will be stored in ppm-raw or pgm-raw format (P6 or P5)
type-of-target  : 0 ... PPM
                : 1 ... PGM
                  The Watermark will always be done like it would be on a color
                  picture, but if 1 is selected only the Luminance is saved
preprocessing1-3: 0 ... prevent wrong pixel values by brightening or
                        darkening the picture
                  1 ... prevent wrong pixel values by truncating the picture
                  2 ... if the pixel value is < 0 or > 255 set it to 0 or 255
                  3 ... if the pixel value is < 0 or > 255 take it modulo 256
from1-3         : minimum raise by watermark on channel x
to1-3           : maximum raise by watermark on channel x
                     from < to
                     both values must be either positive or
                     negative if preprocessing=0
marking-method1-3: 0 ... random value is used (between TO and FROM)
                   1 ... indicates that a dark part in the picture
                         should be rised the maximum value, while a
                         bright part should be rised the minimum value
                   2 ... just the other way around