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:
- Press
Command + Space
to open Spotlight search - Type “Terminal” and press Enter
- 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:
- 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)"
- Paste it into Terminal (Command + V) and press Enter.
- 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.
- 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.
- 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:
- Type this command in Terminal:
brew install imagemagick
- Press Enter and wait.
- 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:
- Type this command:
magick -version
- 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”
- Select “Plain text”.
- 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.
- It’s 15 pixels by default.
-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 |
Camera | ILCE-7RM5 |
Focal length | 172mm |
ISO | 100 |
Shutter speed | 5s |