12

Similar question here but for Tex -document. Imagemagick shows ways of watermarking here but not how to do it as invisible as possible. I currently just obfuscate some functional elements into photos so extremely hard to remove, without distorting the image itself. Is there some commandline tool to add invisible watermark to images, something like to check with microscope perhaps but still readable? I have a massive tree of images (of very different variety so watermark should adopt to env etc) -- some commandline tool to add watermarks fast invisibly on every photo?

  • 2
    I think your invisibility requirement is at odds with the purpose of watermarking. If the watermark is invisible to a normal viewer then it can probably removed by doing a couple of JPEG conversions on the image, since by design JPEG smooths away details that people won't miss. – Kyle Jones Feb 07 '12 at 03:41
  • @KyleJones: who required JPEG as a format? Imagemagick contains only examples, my goal is to obfuscate watermarks into pictures by hiding them a bit like changing a dot in Tex. –  Feb 07 '12 at 08:22
  • 2
    My point is that JPEG conversion or any other lossy image compression algorithm would be able to remove such a watermark, not that the image necessarily had to start out as a JPEG. – Kyle Jones Feb 07 '12 at 18:36
  • The comment that this has no purpose is wrong & misguided. Sure, "invisible watermark" is an oxymoron, but it's a useful shorthand for the abstruse "steganographic message" -- which almost always will get autocorrected into "stenographic" (i.e., literally, shorthand). Here's a backgrounder on use cases: http://www.lia.deis.unibo.it/Courses/RetiDiCalcolatori/Progetti98/Fortini/watermarking.html and one example implementation: https://www.howtoforge.com/tutorial/linux-image-steganography-and-watermarking/ – michael Dec 03 '18 at 03:31

2 Answers2

10

I believe what you're looking for is steganography, a way to hide a message in otherwise innocent-looking content.

There doesn't seem to be a wealth of tools out there for this on Linux, but outguess1 and steghide2 would do what you want. openstego is another one (with a command-line interface).

Example with outguess, I copy/pasted the text of your question in Q.txt:

$ ../src/outguess/outguess -k 'Unix&Linux' -d Q.txt Tux.jpg Tux_steg.jpg
Reading Tux.jpg....
JPEG compression quality set to 75
Extracting usable bits:   10126 bits
Correctable message size: 5008 bits, 49.46%
Encoded 'Q.txt': 4592 bits, 574 bytes
Finding best embedding...
    0:  2274(49.2%)[49.5%], bias  2008(0.88), saved:     2, total: 22.46%
    3:  2269(49.1%)[49.4%], bias  2007(0.88), saved:     3, total: 22.41%
   13:  2268(49.0%)[49.4%], bias  1977(0.87), saved:     3, total: 22.40%
   62:  2237(48.4%)[48.7%], bias  1992(0.89), saved:     7, total: 22.09%
   78:  2216(47.9%)[48.3%], bias  1964(0.89), saved:    10, total: 21.88%
78, 4180: Embedding data: 4592 in 10126
Bits embedded: 4624, changed: 2216(47.9%)[48.3%], bias: 1964, tot: 10119, skip: 5495
Foiling statistics: corrections: 1437, failed: 746, offset: 198.494881 +- 300.529142
Total bits changed: 4180 (change 2216 + bias 1964)
Storing bitmap into data...
Writing Tux_steg.jpg....
$ ../src/outguess/outguess -k 'Unix&Linux' -r Tux_steg.jpg out.txt
Reading Tux_steg.jpg....
Extracting usable bits:   10126 bits
Steg retrieve: seed: 78, len: 574
$ diff out.txt Q.txt 
$ echo $?
0

Source image (from Tux.svg):

plain JPG, no watermark

Image with your question hidden inside it:

file with hidden information

The images are different if you look closely, but it's pretty much as if the second one had been generated with a higher JPEG compression level. The fact that the complete text of your question is mixed in (and password protected) isn't noticeable visually at all.
The smaller the hidden message, the less visually different the images will be. (I can't distinguish visually between the original and a file with "Copyright YOU 2012" embedded.)

1old, but builds just fine.
2 doesn't build with a modern C++ compiler, a few source fixups are necessary.

Mat
  • 52,586
0

There must be a way to embed a quite stable watermark into the image, DigiMark does it e.g. in Photoshop filters - so why shouldn't a command line tool be able to do as well?

This is no solution, but an idea how it may work... if you create an invisible watermark on a blank white image and blend the resulting code into any other image, the watermark-reader is able to extract the wartermark from the resulting image again - even when modified/cropped or printed and photographed again.

So actually batch adding a given watermark gradients code won't be the problem - rather finding an appropriate signing algorithm and sotware to extract the watermark.