Yesterday I posted my thoughts on watermarking images for uploading to the web. This post formed the basis of myself and Allison Sheridan’s discussions in the Chit Chat Across the Pond segment on tonight’s Nosillacast Mac Podcast. During the discussion we talked a little about how I watermark my images, and I realised that I hadn’t released a version of my image processing scripts since 2008! I promised I’d remedy that, so today, after a little tidying up, I’m releasing the current snapshot of my scripts under the FreeBSD license.

I’m not releasing these scripts as a polished software package that’s ready to use, but rather, as a starting point for anyone who wants to create their own watermarking scripts. If you’re not prepared to get stuck into the command line and a little Perl (VERY little is needed mind), these scripts are of no use to you!

The scripts rely on the free and open source ImageMagick command line image editing tools, so you’ll need to install ImageMagick before you get stuck in. If you’re running OS X, I’d recommend installing ImageMagick via the free and open source MacPorts package manager.


All the core functionality provided by the scripts is contained within a single perl package, Any customisations you want to make to the watermarks will need to be made here. The code is well commented, but, unfortunately, it dates back to before my conversion to the Perl Best Practices religion, so it barfs out an embarrassing number of warnings when run through perlcritic. I do plan to re-write it some day, and when I do I’ll be making it object orienting, and ensuring that, like all my recently written code, it passes perlcritic.

All command line interactions with the functionality contained within is accessed through the perl script Once you have the scripts up and running, you should never have to edit this file, it really is just a wrapper. If you add any new functions to you’ll need to be sure to add an entry for them into the $WebifyImages::functions hashtable or they won’t be accessible via

Installing the Scripts

I haven’t written an installer script, so you’ll have to do a little work by hand here. Again, don’t even bother starting with this until you have ImageMagic installed, and know where on your system the binaries for it are located. If you follow my advice and ImageMagick install via MacPorts, the binaries will be located in /opt/local/bin/. If you want to check where they are located, just run:

  1. which mogrify

This should return something like:

  1. bart-imac:~ bart$ which mogrify
  2. /opt/local/bin/mogrify
  3. bart-imac:~ bart$

This shows that my ImageMagick binaries are indeed in /opt/local/bin/.

  1. Unzip the download package, and copy it’s contents to a folder of your choice on your system. I recommend something like ~/scripts/webifyImages/ (where ~ is your home directory)
  2. Open the file and make the following edits:
    1. Set the value of $WebifyImages::HOMEDIR to the location you extracted the zip to. If you used my suggested installation location, you won’t need to make any changes here.
    2. Set the value of $WebifyImages::IMAGEMAGICK_BIN to the location where your ImageMagick binaries are installed.
  3. Open the file and edit the use lib directive on line 33 so that it contains the absolute path to the folder where is located.
  4. If your OS’s copy of Perl is not located at /usr/bin/perl, you’ll need to edit the first line of both and to reflect the path to your instance of Perl. (this location is the default on OS X and most versions of Linux, so you probably won’t need to change this)

Customising the Scripts

The first thing you’ll want to do is create your own versions of the image files containing the URL that will be stamped on the images. You’ll need to do two versions of your image file, one on a white background, and one on a black one. I’ve included the Pixelmator files I used to generate my image files in the dev folder inside the archive, if you’re a Pixelmator user you might find them helpful. Once you’ve created your own image files and saved them somewhere, update the values of the variables $WebifyImages::URL_ICON_ONWHITE and $WebifyImages::URL_ICON_ONBLACK in with the new file paths.

Once you’ve done that you’ll also need to update the URLs in the functions insertUrl() and insertSemiTransparentUrl() on lines 224 and 236 of

At this stage you’re ready to start using the scripts, but you may want to do some more customisation.

If you want to change the fonts used by the scripts, you can edit the variables $WebifyImages::SCRIPT_FONT, $WebifyImages::SANSSERIF_FONT, and $WebifyImages::CAPS_FONT in

If you use a license other than Creative Commons Non-Commercial, Non-Derivative, Attribution, then you’ll need to create your own image file to represent that license (or download a different CC icon from the Creative Commons site if you are using a different flavour of CC), and edit the variable $WebifyImages::CC_ICON in with the path to your image.

Using The Scripts

The first thing to make VERY clear is that THESE SCRIPTS ALTER THE IMAGES THEY ARE APPLIED TO. They are designed to be used on images exported from an image management package like Aperture or Lightroom, and are NOT designed to be used on your master images!

You apply the functionality contained in to images by changing to the directory containing the images in the terminal, and then invoking on those images. To make things easier you probably want to add the folder you installed the scripts into to your path. The script is invoked in the following way:

  1. [function_name] [function_arguments]

To get a list of available functions, and a description of the arguments they expect, run:

  1. list

That really is all there is to it – you can just use my scripts as they are (with your basic customisations obviously), or you can tinker and edit to your heart’s content!