Export photos with a border from Lightroom Classic

This is how I add a nice thick black border to my photos after I export them from Lightroom Classic using free software.

This is for macOS, but since the same software exists on Windows, you can do something similar there, but I haven’t used that platform in years, so YMMV.

I’m going to presume you’re familiar with export presets in Lightroom Classic. You’re going to use one of them to run a small script that does the magick.

Take a deep breath. You’re going to learn a lot in the next couple of steps. Persist, and it will be worth it.

Installing ImageMagick

To add the border you need to install ImageMagick using brew. Think of ImageMagick as a Swiss Army knife for images. While Lightroom excels at organizing and editing individual photos, ImageMagick can automatically resize hundreds of images, create contact sheets, add watermarks, or convert file formats. You can do all this without you having to click through each image individually.

Step 1: Open Terminal (It’s Not as Scary as It Sounds!)

Terminal is like a text-based way to talk to your Mac. Instead of clicking buttons, you type commands. Here’s how to find it:

  1. Press Command + Space to open Spotlight search
  2. Type “Terminal” and press Enter
  3. A black window will open. This is Terminal

Don’t panic if it looks intimidating! Think of it like switching from Auto mode to Manual on your camera. It gives you more control once you know what you’re doing.

Step 2: Install Homebrew (Your New Best Friend)

Homebrew is like an App Store for command-line tools. It makes installing software like ImageMagick incredibly easy. Here’s how to install it:

  1. Copy this entire command (click and drag to select it all):
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Paste it into Terminal (Command + V) and press Enter.
  3. You’ll be prompted to enter your Mac’s password (the same one you use to log in). Note: When you type your password, you won’t see any characters appear. This is normal for security reasons. Just type it and press Enter.
  4. The installation will take a few minutes. You’ll see lots of text scrolling by, and this is normal! Grab a coffee and let it do its thing.
  5. When it’s finished, you might see instructions about adding Homebrew to your PATH. If you see a message starting with “Run these two commands in your terminal,” copy and paste those commands one at a time.

Step 3: Install ImageMagick

Now that you have Homebrew installed, installing ImageMagick is incredibly simple:

  1. Type this command in Terminal:
    brew install imagemagick
  2. Press Enter and wait.
  3. This will download and install ImageMagick automatically. When it’s done, you’ll see your command prompt again (it looks like YourName@YourMac ~ % or similar).

Step 4: Test Your Installation

Let’s make sure everything worked:

  1. Type this command:
    magick -version
  2. If you see version information appear (something like “Version: ImageMagick 7.1.x”), congratulations! You’ve successfully installed ImageMagick.

Apart from adding borders to images, ImageMagick can also resize images, convert RAW files to Jpeg, add watermarks and more.

Your first ImageMagick script

Open TextEdit or your favourite text editor to create your black borders script. If you use TextEdit, you need to adjust the settings as follows.

Go to TextEdit → Preferences and under “New Document”

  1. Select “Plain text”.
  2. Uncheck “Smart quotes” and “Smart dashes”.

Copy this code into your editor before saving it in your Documents folder as add_black_borders.sh

#!/bin/bash

# Add black borders to export images

today=$(date +%F)

open ~/Pictures/
/opt/homebrew/bin/magick mogrify -bordercolor black -border 15 "$@"

Your computer can’t run the script without making it executable, so use this command to do that:

chmod +x ~/Documents/add_black_borders.sh

Add it to Lightroom Classic

Lightroom Classic has an “after export” setting in the export dialog you can use to modify the photo(s) you just exported. You’re going to write a small computer programme called a “shell script” that uses ImageMagick to add the border.

Right click on an image, go to Export and click on Export..... Select your export preset and scroll to the bottom, to “Post-Processing. It will look something like this. Click on the “After Export” setting and then on “Go to Export Actions Folder Now”.

A new Finder window will open there. It should be Library/Application Support/Adobe/Lightroom/Export Actions/ in your home directory.

Copy the script from your Documents folder to the Export Actions folder by dragging it from one folder to the other.

Export with Borders

Go to your desired export action in the Export... menu in Lightroom Classic. Scroll to the end, and the After Export setting will have your add_black_borders script.

Select that, and remember to update the settings for your export preset.

Export an image, and it should have a black border. The Pictures folder will pop up too, but you can change that in the script in the line that says open ~/Pictures/. Change that to wherever you put your exported images.

Customize the output

You can change the border width and colour in the script. Look at the magick line.

  1. It’s 15 pixels by default.
  2. -bordercolor black can be changed to whatever colour you want from this list.

Search online, and you’ll find other commands to further change how the border looks.

Bonus: split panoramas

Here’s a bonus script. Save it as panorama.sh in the Export Actions folder. Add it to an export action you use for horizontal panoramas. Vertical panoramas can be split using 100%x33.33% instead.

#!/bin/bash

open ~/Pictures/
for file in "$@"; do
        base=$(basename "$file" .jpg)
        out=$(dirname "$file")
        /opt/homebrew/bin/magick "$file"  -crop 33.33%x100% "${out}/${base}_split_%d.jpg"
done

Gobbledygook?

I hope that made some sense, and it works for you. It is unfortunately technical, but take things slowly and carefully, and you’ll have beautiful borders on your exported photos!


Apertureƒ/8
CameraILCE-7RM5
Focal length172mm
ISO100
Shutter speed5s

More fun with long exposure stacking of photos

A few months ago I experimented with Imagemagick by using it to merge very similar photos of flowing water to give the impression of a longer exposure.

Here are a few more examples.

By merging a series of thirty photos taken two seconds apart I created a pleasing image that looks like a sixty second exposure. The day I took these photo was overcast and dull, but not dark enough to do an actual long exposure like that without the help of some fairly dark filters. I used the intervalometer in Magic Lantern to shoot this so I didn’t even need a remote release. My camera did all the work! This was created using the following Imagemagick command line:

convert *.jpg -average average.jpg

2015-11-27-2637-m

average

I combined 60 long exposure shots of the night sky in the mountains of Utah (during the Automattic Grand Meetup a few weeks ago) to create a single long exposure of the stars moving through the sky. Thanks mkaz for publishing this post on interval shooting where I got this command line:

convert *.jpg -evaluate-sequence max combined.jpg

2015-10-15-9699-m

2015-10-15-9757-m

combined

Finally, another series of sixty shots taken in Utah. The same convert command line was used to process these.

2015-10-15-9758-m

2015-10-15-9817-m

combined

In the image above I should have cloned out the wires in the bottom left of the image. Lightroom makes it easy to make the same modifications to every image. Work on one image, then select all the ones you need and click “Sync Settings”.

It can be frustrating taking these types of photos as your camera is shooting a long series of very ordinary shots, and the final result can’t be seen until the images are processed correctly but it’s certainly worth it.

Update on December 1st: here’s one that didn’t work out so well. It was so windy the camera shook the whole time.

combined photo

Aperture ƒ/4
Camera Canon EOS 6D
Focal length 17mm
ISO 1600
Shutter speed 30s

Long Exposure Photography through Stacking

The usual way of taking long exposure photos is by leaving the shutter open for a long time. This requires either a dark location or ND filters of some sort on the end of your lens. There is another way and that’s called image stacking.

In a nutshell, you take a series of well exposed photos of short exposure for the same duration you’d use for a long exposure shot. Then in development you create a number of images files which are then merged together to create a final “averaged” image. You can use Photoshop, GIMP, Imagemagick or I presume many other apps to create this image. I used Imagemagick here as I don’t have Photoshop and didn’t want to load all those images into GIMP and I had read that “convert” would do a good job.

Here’s one I created earlier today in the slightly shady but bright gardens of Blarney Castle:

The images that went into creating that image all look like this. They were shot at f/4, mostly shot at 1/80 of a second and ISO 100. I wanted fast images with minimal noise and the scene is mostly flat so I wasn’t too worried about depth of field.

2015-06-19-4106-gp-2

To make this image I took 27 photos of the scene. I imported them into Lightroom (didn’t do much apart from applying my default settings) and exported Jpeg files. In the directory where I exported them I ran the convert programme from ImageMagick like this:

convert *.jpg -average average.jpg

That command was used by Luis Argerich, the author of this post who created a simulated 4 hour exposure of the sky and went on to say:

Averaging can be used in static scenes to create a new photo with less noise. Noise is reduced in the function of the square root of the number of images. So if you average 25 shots you have 5 times less noise than in a single image.
Averaging can also be used in non-static scenes to simulate a long exposure.

Patrick David in this post suggests a slightly different command which I tried and it created a similar photo.

If your exposure somehow went wildly different with some images bright, some dark, use the “Match Total Exposures” feature in Lightroom to pull them back.

ImageMagick is fairly easy to install. If you are using Linux you probably already have it installed. You can download it from this site or if you use Mac OS X, install Homebrew and then it’s as simple as this to install:

brew install imagemagick

Here are a few more examples:

average

This one didn’t work out. I was trying to capture the swirling of the bubbles on the water.

average

This one works better. The source photos are all around 1/25th of a second which is certainly not fast enough to freeze the water.

average

Almost happy with this one. The source photos go from 1/60th to 1/100th of a second.

average

I like this. It was created from ten photos shot at f/4, 1/60th sec, ISO 100.

I didn’t try very hard to make the images here pretty. They’re purely experimental and done with minimal effort but I’m very happy with most of the results. In shaded daylight I was able to take the equivalent of five to ten second exposures without ND filters or reducing the size of the aperture. It would have been easier to make the aperture smaller and add an ND filter but that’s not the point of this exercise.

One issue that may bite you is the speed of your media. My camera quite often flashed a “busy” notice because it was writing to the SD card. Then again, I was shooting 20MP images and my card says it’s rated at 30MB/second which is a problem as each image is around 20MB. As they’ll only ever be viewed online that’s probably not really needed. I might try the half-size option next time.

One nice bonus to this method is that Google Photos will generate nice animated GIFs from your image stack. I posted mine here. I won’t embed them as the files are huge!

I’m definitely trying this out again!

Aperture ƒ/4
Camera Canon EOS 6D
Focal length 24mm
ISO 100
Shutter speed 1/60s