Thursday 28 May 2009

Watermarking your images with steganography

Once your images, be it photos, digital art, comics or whatever are uploaded into the web to blogs, web pages, flickr etc. there is the risk of improper usage.

The most obvious way to protect your images is the watermark which most image manipulation programs can insert. These are difficult to remove and usually protect your content well enough.

The options when you don't want a big watermark spoiling your image are less ideal. Most (if not all) digital watermarking techniques use steganography methods, that is hidding the watermark inside the image data. And most of them can be fooled. Their biggest weakness is that the current algorithms have problems to hide content on small images, for example less than 100 x 100 pixels. So, an easy way to circumvent the watermarking is to cut the image into cubes and add them together at display time. Also, some algorithms will lose the watermarking with simple image manipulation techniques as resizing and cropping.

But steganography has one advantage, and that is the fact that it is not obvious that the image is protected.

An important factor when deciding how to protect your images is to decide what are you trying to protect them against. Steganography won't protect your images against them being manipulated, but it can protect them from being resold "as is". So, if someone wants to use my image as a starting point for some other design work, steganography won't stop them. But probably watermarking won't either.

Some things that don't bother me that people do with my photos:

  1. Print them and enjoy them privately. Hey, maybe they will commission some work, show it to their friends etc. Word of mouth is a powerful thing.
  2. Use them as a starting point for artwork. I am personally an open source enthusiast and I think the philosophy applies to other areas of life as well. Usually the end result will be different enough from my original work that it could be considered more inspiration than anything else. And they may even mention my name.

Things that I want to avoid:

  1. Someone using my work as if made by themselves.
  2. Someone reselling my work without my consent.

And for these two, steganography probably works because they would like to have the best quality unmodified copy of the images. Also, if they can't be bothered to use their own work, they will also won't be bothered to put some work into discovering if the images are watermarked or not. And if they actually run an application to discover that they are watermarked, they still won't know what method to use to effectively remove it - the safest thing would still be to move on and copy somebody else's work.

So, I have started using an open source program to digitally watermark my photos. Its called outguess. One of the drawbacks is that you have to compile it yourself.

On a Linux platform, just do:

tar xvzf outguess-0.2.tar.gz
cd outguess
./configure
make

This assumes you have development tools installed. For Ubuntu/Debian try:

sudo apt-get install build-essential

if it fails to build.

Once the binaries are there, just do:

./outguess -k "mykey" -d message.txt input_file.jpg output_file.jpg

Where:

mykey is any text string you want. I use an email address as it's easy to remember.
message.txt is a text file with the message you want to embed, something like 
- (c) 2009 myname All rights reserves - myemail@server.com -

To extract a message from a file, just do:

./outguess -k "mykey" -r file.jpg extracted_msg.txt

Where:

mykey is the same key use to embed the message.
file.jpg is the output file of the embedding command
extracted_msg.txt is a text file where your message will be printed.

I personally use a small python script to apply the watermark to a batch of files.