Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'watermarking with ImageMagick' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
watermarking with ImageMagick
Authored by: mzs on Apr 14, '04 01:51:54PM
You can use this tutorial on watermarking with ImageMagick to write the shell script that does what you want. Then you will want to make a do shell script ... AppleScript to attach to a folder action.

The thing is that JPEG is lossy so by doing the watermark with the convert (from ImageMagick) you will lose some quality. You may like to look into the droppatch for the Independant JPEG Group codebase. You can read more about droppatch, croppatch, and EXIFpatch here. If I recall correctly the Exifpatch is already included in the croppatch and droppatch candidate. The IJG homepage is here.

So what do I mean by the last paragraph? You might like to use jpegtran -crop ... to splice-out the portion you will watermark from your original image. Then you would do one big convert ... command to create the watermark. Finally you would use jpegtran -drop ... to add your watermark. If ImageMagick changed the sampling factors to 8x8 from 16x8 (or some other convolution like that) you would use export to BMP in the convert command and then use a cjpeg -sample HxV ... (cjpeg is part of the IJG codebase) before the 'drop' (but it is possible that convert may have an option for this).

Whew...

If by watermarking you meant something like changing DCT coefficients or a spread spectrum approach, there is some nice academic literature on this (the adaptive spread spectrum techniques are neat in particular) but except for some matlab files there really is nothing out there that I know of available. If you know of anything like this, I would love to hear about it though!

Oh, two more points. Do not use sips -s copyright 'Joe Blow' ... to add a copyright since sips will recompress the image and destroys your original! Also you might think that wrjpgcom -c 'copyright Joe Blow' ... might do the right thing, but EXIF is not a bunch of JPEG COM markers. But it might be a good idea to do the wrjpgcom anyway since less people know about the COM markers than the EXIF copyright property. So if someone stripped-out the EXIF copyright property (or worse changed it) but did not know about the copyright comment that would be beneficial to you if your copyright was infringed.

Really none of this is going to do anything to seriously protect your copyright though. If you use steg to 'hide' a copyright notice, then almost any trivial image manipulation (such as recompresion) will most likely remove that. The DCT and spread spectrum watermarking techniques could be easily identified with statisical analysis. Then the infringer could use the same tools to insert his own copyright notice. Changing the JPEG comments and EXIF properties is trivial. And of course anyone with PaintShop or GIMP can crop/mask/blur your watermark in the image itself. A very determined infringer could do all this. So if you really care, why not just register all of your images that you care about with the copyright office and skip all of the watermarking that degrades the image itself.

Spread spectrum or DCT coef watermarks cannot really be useful unless there is an impartial third party involved and some crypto hashes are used. But then all those watermarks can be replaced, the image can be cut-up into bits and reassembled with HTML to prevent there being enough bits of the watermark in a single part to identify, and placed behind logins so that spiders cannot see the infringing file easily, so what is the point really...

[ Reply to This | # ]