How to Watermark Images with ImageMagick
Watermarking your images is one significant component of building your brand on the Internet. In the post How to Brand Your WordPress Images with Pixelmator’s Watermark Action I described how you can watermark your images with the excellent Pixelmator application. But the workflow is limited and has some drawbacks:
- Small images get upscaled, which results in blurry images.
- All images get watermarked, even images which are smaller than the watermark.
- Positioning of the watermark is limited, as you have only 9 positions to choose from.
- You need to buy a license for Pixelmator.
Watermarking with ImageMagick and Automator
With the proposed workflow you will have to do nothing more than storing your images in a specific folder on your computer. Resizing and watermarking the image will be done automatically.
Check if ImageMagick has been installed on your computer. On a Mac you can do this via the Terminal application. In the Terminal window just enter
convert --version. If it is installed you will see the version number printed.
If you get something like
-bash: convert: command not found, then read my post on How to Install ImageMagick with MacPorts if you are using a Mac.
If you are on Windows go to the ImageMagick website and download the application. You can still use the bash script I provide below and adapt it to your needs. Should you prefer a stand alone application, have a look at TSR Watermark Image Software. I have heard good things about it, but never tried it for myself, because, well, I use a Mac.
Automator is an application which is included in every OS X installation. With this program you can easily automate workflows you do over and over again. I will show you how you can set up a workflow which will be triggered automatically on a file when saved into a specific folder. This is called an Automator folder action.
The new folder action we will be adding does several things for us:
- It creates a new folder named originalImages within your images folder where it saves the original file.
- It creates a new folder named watermarkedImages within your images folder where the processed images will be saved.
- It shrinks the image if it has a width greater than 500 pixels. You can change this easily.
- It watermarks the image, if it has a width greater than 299 pixels.
Adding the New Automator Workflow
Here are the step by step instructions on adding the new Automator workflow. This workflow has only one Automator action: Run Shell Script
- Create a folder where you want to save your images and screenshots.
- Open Automator on your Mac, then click on
File > Newin the menu and select the workflow template Folder Action.
- Drag the Automator action Run Shell Script from the actions library to the right pane in Automator and drop it.
- Select /bin/bash from the drop down box labeled Shell.
- Select as arguments from the Pass input drop down box.
- At the top of the window select the folder you created in step 1. In the screenshot below it is named ConstrainSizeAndWatermark.
- Download the bash script I prepared for you and paste its contents into the Run Shell Script action, overwriting the default.
- Change the WATERMARK_STRING to your needs in the script you just pasted.
- Compare your settings to the following screenshot and than save the folder action.
Now, try it. Make a screenshot with the Grab application, which should be installed in
/Applications/Utilities/ on your Mac. Save a random screenshot in the folder you created in step 1 above. After waiting for a second or two you should see your watermarked image in the folder watermarkedImages.
This procedure can save you a lot of time. Let me know of any improvements you make to this Automator workflow in the comments. Thanks.