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!


5 Responses to “ – My Image Editing Scripts (v0.2)”

  1. #371 Verizon Mifi Jetpack 4G, Cobooks, Flame Virus for Windows, Image Watermarking | Nosillacast on June 18th, 2012 1:33 am

    [...] #371 Verizon Mifi Jetpack 4G, Cobooks, Flame Virus for Windows, Image Watermarking By podfeet on 17 June 2012 Bart answers Steve’s question about why the cosmos forms in a disk before spinning. I review Verizon’s latest Mifi offering, the new Jetpack 4G. I review the Address book alternative Cobooks from In Security Lite Bart explains the importance of the Flame virus, and then in Chit Chat Across the Pond he talks through the thought process you might want to consider in whether or not to watermark your images before posting on line and how he goes about doing it. Mark Pouley and Allister Jenks both recommend the donationware plugin BorderFX, or you can check out Bart’s AppleScripts for watermarking at [...]

  2. The Big Watermarking Question : Bart Busschots on June 18th, 2012 7:15 pm

    [...] – My Image Editing Scripts (v0.2) [...]

  3. My Perl Image Processing Scripts : Bart Busschots on June 18th, 2012 7:18 pm

    [...] Update (18 June 2012) – A more up-to-date version of these scripts can now be found here. [...]

  4. #372 Microsoft Surface Tablets, is Apple a Meanie, CompanionLink Software, Why is the Mac Pro Still Important | Nosillacast on June 25th, 2012 2:25 am

    [...] 24 June 2012 Bart’s newly revamped scripts to watermark images are now available at under the FreeBSD license, my thoughts on the two new Microsoft Surface tablets. In Dumb Question [...]

  5. Dorothy Rendon on June 28th, 2012 8:42 pm

    Getting some cool effects here. Thanks.

    FYI: Here are some more detailed installations if you are starting from a vanilla system (i.e. no MacPorts or Xcode)

    1. Create directory “/opt/local” using “sudo”
    a. Cd /
    b. Sudo mkdir /opt/local
    2. Install Xcode from app store
    3. Start up Xcode
    4. Open Xcode Preferences and select Downloads tab.
    5. Locate “Command Line Tools” and click on “Install”
    6. Go to Bart’s website.
    7. Follow the link to ImageMagick website, using a new tab in your browser.
    8. On left side, under “Binary Releases”, click on “Mac OS X”.
    9. Follow link to to install MacPorts, using a new tab.
    10. On left side, click on “Installing MacPorts”
    11. Follow instructions on installing MacPorts. MacPorts is installed under /opt/local
    a. Click on “Lion” in text and download MacPorts package.
    b. Install package
    12. Return to ImageMagick website tab and follow instructions to install ImageMagick (which also installs under /opt/local)
    13. Do installation test from a terminal. This verifies the command line environment is set correctly. MacPorts should do most of the setup for you. You might need to open a new terminal window.
    14. Unpack & install Bart’s WebifyImages scripts. He put his in ~/scripts. I put mine in ~/Applications.
    15. Follow his instructions to install and customize. Search for “bartb” in for other places to customize.

Leave a Reply

Before you post a comment please remember that commenting on my blog is a privilege not a right. I won't approve comments that are obscene, offensive or insulting. For more info please read this post.

Subscribe without commenting