Putting Up Borders

In today’s dispatch, I’m going to show you an easy-ish way to create borders for your photos on export in Lightroom Classic. Note that the steps provided are for MacOS, but you can certainly adapt the directions for Windows if that OS is your preferred platform.

Prerequisites

Before we get started, we need to have a couple of items in place:

  • ImageMagick
    • ImageMagick is a command-line tool for manipulating images. You can find the tool’s site here. Personally, I use Homebrew to install/maintain/update this package (and other packages) rather than downloading from ImageMagick’s website and installing from there. Homebrew is a package manager for installing/updating software on MacOS. It is a command-line tool, but you can also use Cork as a graphical user interface. Once you’ve installed the Homebrew command-line tool or Cork, you can install ImageMagick. On the command-line, enter the command brew install imagemagick. In Cork, simply search for ImageMagick and install it.
  • Jeffery’s Run Any Command Plugin
    • This plugin allows you to add an export action to your Lightroom Classic export presets. We’ll use this to tell ImageMagick to add borders to our exports. To install the plugin, head over to Jeffery’s site, download and install. (incidentally, Jeffery has a bunch of super-helpful plugins, several of which I use in my workflow).

Configuring Exports

Now that you have the prerequisites ready, you’re ready to configure your export preset with borders. You can start by going to File→Export… or right-clicking on any photo in your catalog and choosing Export→Export…

On this screen, you can start by clicking the “Add” button to add a new export preset. You can also start with an existing preset and then later save as a new preset once you’ve completed configuring your export.

Give your export preset a meaningful name.

Configure your export settings as you would with any export:

The next step is where the magic happens (or, I guess in this case, “magick”). On the left pane of the export window, you should have a new export action called “Run Any Command”.

Click that, then click insert.

You’ll now have a new section in the right side of the export preset dialog called “Run Any Command”.

To add borders, we add the following command to the “Command per Image” text box (note that this command assumes you have installed ImageMagick via Homebrew. If you installed it by any other method, you will need to find the full path to the magick command).

/opt/homebrew/bin/magick convert "{FILE}" -bordercolor white -border 10x10 "{NAME}_border.jpg"

Breaking this down:

  • opt/homebrew/bin/magick
    • This is the full path to the magick tool.
  • convert
    • The ImageMagick argument to process the image
  • "{FILE}"
    • A token for the full path to the image that was exported. The full set of tokens for the Run Any Command plugin is documented here under the section “Command Metasequences”.
  • -bordercolor white
    • This argument tells ImageMagick what color border to apply. This argument is documented here. The color names are documented here. You can also get a list of colors by running the command magick -list color in the MacOS terminal.
  • -border 10x10
    • Specifies the geometry of the border, documented here. In this case, we add a 10-pixel border to all sides of the image.
  • "{NAME}_border.jpg
    • This tells ImageMagick to save the file with the border as the original filename with “_border” appended. Note that if you are exporting in another format, you will need to change “.jpg” to the correct filename extension (i.e. .tif)

Once we’ve configured our export preset, we can right-click its name in the list of export presets and choose “Update With Current Settings” to save it.

Clicking the Export button will export the image and add the border. You can update the command line and create multiple export presets to change border sizes and colors. A few examples from the same image:

10px White border—unfortunately, this isn’t a good example since the background on this site is defaulted to white.
10px LimeGreen border
500px x 10px DarkOrchid4 border. This was accomplished by setting the value of the border argument to 500x10

ImageMagick is a powerful tool and there is a lot to dig in to. Some interesting things you can do with it, either on its own or combining it with an export action are:

Create Contact Sheets

magick montage *.jpg -tile 3x3 -geometry +5+5 contact_sheet.jpg

Apply Color Effects

Sepia:

magick photo.jpg -sepia-tone 80% sepia.jpg

Black and White:

magick photo.jpg -colorspace Gray bw.jpg

Add Watermark

magick photo.jpg -gravity southeast -pointsize 24 -fill white -annotate +10+10 "{copyright text}" watermarked.jpg

Special Effects

For example, make a charcoal drawing:

magick photo.jpg -charcoal 2 sketch.jpg

Tiling for Printing

If, for example, you have a photo that you want to break down into smaller pieces for printing so that you can assemble the prints into a large display after printing, you can do something like

magick big.jpg -crop 3x2@ +repage +adjoin tile_%d.jpg

These are just a few examples of fun/interesting/helpful things you can do with ImageMagick. ChatGPT can help you come up with other ideas and craft the command-line inputs to do pretty much anything you want.

Questions? Comments? Concerns?