Problems with fourier watermarking on command line



I’m trying to automatize bulk fourier watermarking using the comand line version of G’MIC, but I have trouble when trying to read the watermark.
Looking thru the examples, I tried this one:

image.jpg --watermark_fourier “Watermarked!” --display_fft -remove[-3,-1] -normalize 0,255 -append[-4,-2] y -append[-2,-1] y

That results four images, the fourth one with the watermark clearly visible.

Then this is the code I tried:

gmic -input image.jpg -watermark_fourier watermark_text -output image_WM.jpg

And the code to get the wartermark:

gmic -input image_WM.jpg -display_fft -normalize 0,255 -output image_SW.jpg

But when done this way, the watermark is barely visible, and I don’t know why doesn’t work like the example.

I’m using the 64 bit Windows 1.7.9 version.

(David Tschumperlé) #2

You are right. I think the .jpg compression kills the high frequencies, where the watermark message is hidden, so it becomes invisible after jpg compression + the fact we have to cut the values in [0,255] also limits the frequency data
(if you save your result as a 32bits float-valued tiff, the message clearly appears after reloading the image).

There are probably some improvements to make anyway. I’ll think about it.


Thanks for the response.
I have done some more testing, and it’s like you said. If you save the image uncompressed, the watermark survives.
But then, what it’s its use? Putting an invisible watermark it’s supposed to make the message survive after cropping, resizing and recompressing the image (up to a reasonable level, of course). If it doesn’t even survive the first saving, I don’t know what it is for…
Is there a way to alter the behavior of this filter so it has a proper functionality? I don’t really mind if this means adding some kind of noise or other artifacts to the image, unless they’re too distracting.


I’m sorry to resurrect that thread, but I would like to know if there’s a solution to my problem.
I just want to know if there’s a way to add some kind of not-evident watermark to an image that later can be retrieved even if the image was cropped, altered, resized or recompressed.

(David Tschumperlé) #5

I’m afraid that right now, it is not possible to have a watermark technique in G’MIC that is robust to alterations. Sorry about that. This is maybe something we may add in the future, anyway, if we find a good-enough technique to do so.

(Morgan Hardwood) #6



I got to the “Wavelet Based Steganography and Watermarking” document, where they talk about “digital watermarking”, and I quote:

[…] the goal of digital watermarking is to hide a watermark (some sort of identification data) within the image, so that it is not perceptually visible to the human eye, but also so that it is robust enough to withstand the various kinds of transformations. The transformations we consider include graphic file conversions, geometric distortions (such as blurring and sharpening), and cropping.

This is exactly what I’m looking for. Does somebody know of any implementation of this?

(Robert Thorsby) #8

I attempt to permanently watermark my photos using steghide from the command line. I protect the embedded copyright file with a strong auto-generated password.

Steghide is usually pretty good because its embedded files cannot be detected by most steganographic applications – which makes deleting the hidden file a bit more difficult.

Of course, I also add visible watermarks and metadata so there are plenty of “normal” targets for the black hats to aim at.


(Jonas Wagner) #9

@Spyd Do you have an example of this working out in practice? A watermark that contains a reasonable amount of information that is robust enough to survive heavy re sampling, cropping & compression without affecting image quality in a perceivable fashion?

At least intuitively that seems to be at odds with image compression which tries to get rid of exactly the parts of the information in the image that does not affect perception all that much.


I don’t understand the purpose of hidden watermarks. Visible watermarks keep honest people honest. Invisible ones, since they are… invisible, cannot be a deterrent to copyright infringement, even by honest people. And as a proof of authorship, they aren’t worth the CPU time, since you can always add your watermark to someone else’s picture.

The only way to prove authorship is to show the same picture either unedited, at a higher resolution, or uncropped, or other (unpublished) pictures from the same shooting session.


Didn’t know steghide. I tested it, first in Windows: the app crashes like crazy. Just make a mistake typing the command line, and it crashes. Also, it can’t open files created by IrfanView, because it also crashes.
I tried in Ubuntu, and while it worked without crashing, the message does not survive any kind of image manipulation.
I hoped that as steghide can store lots of information (9Kb in a 1Mpx image), it would be robust if you only stored a short string, but no.

I don’t think steghide has any usefulness as a watermarking method, except if the image does not have any visible watermark, because if it has, as soon as the visible watermark gets edited or cut, the steghide will go with it as the file is saved again.

Thanks anyway.


My idea is a method that hides a small quantity of data in the image, like 32 to 128 bits.
If this info is embedded in the image with some sort of error-correction and repeated and scaled everywhere in the image, it should survive cropping, altering, resizing and recompressing the image.
Of course, nothing wil survive “heavy re sampling, cropping & compression”, but if images are leaked online, they get edited (sometimes not) to get rid of the visible watermarks, or they get opened and saved again to get rid of metadata, but they never get abused to the point where there’s a notable loss of information in the image itself.


I’m not trying to use this as proof of authorship. I need this to use it as proof of “leakship”.
This is for images that are given as rewards to users, and should not be shared online. The idea is to have every image linked to the user who downloaded it, so if it is leaked online, you know who the culprit is, and can do something about it.

Note: sorry for the multiple posts, next time I’ll reply everyone in a single post.