lnl has asked for the wisdom of the Perl Monks concerning the following question:

I need to add watermarks to jpg images as I create web pages in my Perl CGI script. I started down the path of using ImageMagick, but the task has proven overwhelming for me. I don't have root access, and the program is way big. For my simple needs, is there a simple way? Gracias, --lnl

Replies are listed 'Best First'.
Re: Dumb Question #2 - ImageMagick
by cLive ;-) (Prior) on Dec 31, 2001 at 04:20 UTC
    Not specifying exactly what you mean I can only guess...

    I'm a bit rusty on this, but I think the syntax you need is something like this:

    # $image is current pic # $watermark is "faint-dark-grey-design-on-black- # background-image" object. $image->Composite(compose => 'Plus', image => $watermark, x => 10, y => 10 );
    where x and y are the offsets for the watermark (I think :)

    hth

    cLive ;-)

      hmmm... that looks simple, but I assume you're showing how to use Image/Perl Magick. My problem is that the install is too complex for the simple use I would put it to. Thanks-- --lnl
Re: Dumb Question #2 - ImageMagick
by BMaximus (Chaplain) on Dec 31, 2001 at 11:07 UTC
    You're pretty much reinventing the wheel. If you put a watermark in your images. How are you going to find the individual who is plagiarizing them? It's a big interenet out there. My suggestion is to use Digimarc's service which you can use Photoshop to put watermarks in your images and let Digimarc look for those who are infringing on your intellectual property while giving you more time to create more images and maintain your site. Digimarc's spider goes out to look for images that are your property and if they are not on your site it will let you know. If your images are your bread and butter then I think it would be well worth the price.

    BMaximus
      Sure... I guess a two-pronged attack is even better. "Fingerprint" (this is really what Digimarc does - it isn't readily visible) the images to find the perps and "watermark" to make it a royal pain for them to steal. I already have Digimarc registration available to me, and will start using it.
      Now I wonder: will the watermark that I add after the fingerprinting destroy the fingerprint?

      Anyway, back to the original question... does anyone know of a Perl shortcut to add watermarks, without having to use ImageMagick?

      --lnl

        I do lots of image work with Perl. You really need ImageMagick or some other image software. You don't want to be attempting to manage image formats yourself. ImageMagick is the best one I've found with Perl. There may be something simple you could do with gimp if you have access to it (it comes wtih most Linux installs as an option).

        But the other reply was correct: Visible watermarks aren't much of a deterrent for theft since someone can easily get rid of them knowing they're there. And there's no tracking tied to them, etc.

        Digimarc has the best invisible watermarking (fingerprinting) I've reviewed. I believe they have some sort of related facility for tracking, but I haven't gotten that far with their software. My understanding is that the Digimarc watermark has to be the last thing you apply for it to remain accurate. So if you apply another watermark, or even compress, after adding the Digimarc watermark it becomes useless. We also found that for some small, compressed images, there's not enough "room" for Digimarc to add their most robust watermark. If you have their software, they'll probably run those stats for you on a given image set.

        ImageMagick is very good IMO. You might want to join their mailing list if you have specific questions. Their web site has details.

Re: Dumb Question #2 - ImageMagick
by Ryszard (Priest) on Dec 31, 2001 at 08:41 UTC

    If you're adding a watermark to prove authenticity of an image, could i suggest doing a super for steganography?

    If you use an MD5 of something or other and insert it into the image, all you have to do to prove the image is authentic (and hasnt been modified) is pull out the embedded message and check it.

    OK, so its a little more complicated than that, but not much more. The mechanism for computing a message is pretty easy using MD5, and bit fiddling a jpg is nice and easy with pack. I guess the considerations are what you will use as the key to create an MD5 (or SHA-1), and where to store it, as well as the automation to do so.

    But i may be off-topic here: If you're using the watermark to degrade an image so people dont use them, this isnt probably the best solution.. :-)

      Yah, the idea is to sell these pix, so I need to watermark them to prevent use of the images.

      Thanks--

      --lnl