Posting Images to Instagram.

Some thoughts on prepping photos in Lightroom for posting to Instagram

A number of people have asked how I prep my photographs before posting to Instagram. If you haven’t seen my stream (Here), posted pictures are standard 1:1.5 Aspect ration, some landscape, padded to square and with a small black border.

Instagram is better than it used to be, when it just cropped everything square it still slightly crops a portrait format and padding square yourself before posting makes sense if you want some control over how your images are displayed

Screenshot 2020-06-20 at 07.53.49

The obvious approach is Photoshop, by hand, but I like to automate stuff where I can; it’s quicker and less prone to error. So, initially, let’s see how we can do all this from a command line and then we’ll see how we can shoehorn it into a Lightroom workflow.
ImageMagick is a command-line tool for manipulating images. It comes pre-installed on macOS by way and the convert command and has a mass of command-line options for converting and editing images from a terminal. ImageMagick may also be installed to windows from I’m going to be working specifically on macOS but everything you see here can be done, with some minor differences, on Windows. Most specifically, on Windows, the command is magick, not convert
Convert, as I’ve said, is a command-line tool, run from the terminal. At it’s very simplest it reads an image file and writes it blackout again to the same, or a different image format, depending on the file extension given to it:
convert foo.jpg foo.png
Will convert foo.jpg to foo.png. If you want to do something to the image before it’s written, you use command-line options. So, for example, to resize an image to half its original size:
convert -resize 50% foo.jpg fee.jpg
Multiple operations are possible by chaining options on the command line. So, the following resize the image to half its original size and adds a default grey border:
convert -resize 50% -border 3x3 foo.png fee.jpg
ImageMagick (/convert/, /magick/) is huge. It can read or write any image format and can perform many edits and transform operations on images (see ImageMagick Options) including padding images and adding borders.
Jumping in at the deep end, this would be a command to add a black border and pad an image to square with white:

convert  \
-bordercolor black -border 0.3%x \
-virtual-pixel background -background white \
-set option:distort:viewport "%[fx:max(w,h)]x%[fx:max(w,h)]-%[fx:max((h-w)/2,0)]-%[fx:max((w-h)/2,0)]" -distort SRT 0 -filter point \
foo.jpg foo_out.jpg

/Line 2: Adds a black border, thickness 0.3% of the image width. We use percent rather than absolute pixel values because we want consistent border thickness regardless of the image’s pixel resolution. A 3 pixel border appears thicker on a 100 pixel image than on a 1000 pixel image. The border parameter allows for different thicknesses on horizontal and vertical borders, separated with an ‘x’ (/0.3%x0.3%/). By omitting the second part of the argument we tell ImageMagick to use the image width for both.

/Line 3/: Tells ImageMagick that it’s padding with white

/Line 4/: Pads the image square by extending the white border we previously placed around the image. I’m not going to even try to unravel this but you can find a discussion on the -fx operator here if you’re really interested.

/Line 5/: paths to the input and output image files

Making a Workflow

All well and good but, as it stands, typing a long command into a terminal, it’s a bit cumbersome. Let’s have a look at how we can slicken it up a bit.

macOS Automator

In the absence of Lightroom – for which see below – I favour an Automator Quick Action. It can be run on a selected image in the Finder and be made easily accessible by adding it to the MacBook Touch Bar or a Finder menu:

In the Automator app:

  1. Choose File->New
  2. Select /Quick Action/ from the document type chooser that pops up
  3. Add a /Get Selected Finder Items/ action by dragging the action from the Action List sidebar on the left into the workflow area(typing ‘selected’ in the search field limits the list, makes the action easier to find)
  4. Add a /Run Shell Script/ action in the same way
  5. Select zsh in the Shell Run Shell Script dropdown
  6. Paste the following code into the script area
/usr/local/bin/convert \
-bordercolor black -border 0.3%x \
-virtual-pixel background -background white \
-set option:distort:viewport "%[fx:max(w,h)]x%[fx:max(w,h)]-%[fx:max((h-w)/2,0)]-%[fx:max((w-h)/2,0)]" -distort SRT 0 -filter point \
 $1 "$path/$filename"_out.$extension

You should now have something that looks like this:

Screenshot 2020-06-20 at 07.45.31

Save the workflow with a suitable name. Now, if you right-click on an image in the finder you should see the action in the context menu under /Services/.
If you’re on a MacBook you can also run the action on selected image files from the Touch Bar. Find it by tapping the /Quick Actions/ button in the Touch Bar

Screenshot 2020-06-14 at 08.18.01

Lightroom and the BFEP export plugin

Lightroom, out of the box, can’t add borders or frames to images. I’ve seen it requested a number of times but it’s not there. But Lightroom is pretty extensible through its SDK and a while ago I looked at writing an export plugin that would, amongst other things, allow me to use apps like ImageMagick to process images using command-line tools as they’re exported.
The plugin download and documentation can be found here. The distribution includes example scripts, including an Instagram script that pads and adds a border as described here. Full instructions in the documentation.

Honourable Mention: BetterTouch Tool

For automation and workflow, BetterTouchTool is beyond awesome. It’s an app that lets you trigger actions from inputs – keyboard shortcuts, mouse and trackpad gestures, key sequences, MIDI devices, even the Apple Touch Bar. Check it out at


2 Replies to “Posting Photographs to Instagram

Leave a Reply

%d bloggers like this: