Hacking Lightroom: The Big Fat Export Plugin

The Big Fat Export Plugin (BFEP) is my plugin for exporting images to disk that fills in a few of the gaps that I’ve found in Lightroom’s vanilla export to disk. I’ve added to it over the years and it’s become so useful I thought I’d share. I hope people find it useful.

BFEP started life when I needed to add tags to images after they were exported to keep track of postings to social networks, competitions and other destinations that don’t easily lend themselves to the excellent Publish Services. I post regularly toTwitter, Instagram and a few others and I maintain a set of smart collections which match keywords so I can see what I’ve posted and to where. I was adding keywords to images by hand which seemed a silly thing to do on a computer so I wrote this plugin, later adding a couple of other features as the need arose.

It’s not a particularly complex plugin, in fact it’s really no more than a simple wrapper for Lightroom’s own Hard Drive exporter but it adds three extra features that the Lightroom exporter doesn’t have.

  1. It allows you to specify a comma separated list of keywords that are added to images exported by the plugin.
  2. It adds a BFEPExportData metadata Field to which date and keyword information is added every time an image is exported using the plugin.
  3. It can optionally run a script or app after an image has been exported. The image path and a user defined set of parameters are included on the script command line. Most commonly the script will be something like Bash, AppleScript or Python. I’ve found it useful for, amongst other things:
  • adding borders to images
  • square padding for Instagram
  • automatically posting images to Twitter
  • Emailing to IFTTT, Evernote, or even people

Example scripts are included with the plugin

Download

Download the zip  file from here and unpack

Installation

Install the unzipped plugin as you would any plugin suing Lightroom’s Plugin Manager File->Plug-In Manager.

Using the plugin

Select BFEP for export using the Export To drop-down menu at the top of the Export dialog. Export in the normal way.

Keywords

Add keywords you wish added to export images, comma separated, to the Keywords input box in the plugin dialog. You may find it. Useful to save export settings for particular destinations in the export list to the left of the dialog. Keywords are stored as children of the BFEP keyword.

Post Export Scripts

Note: Mac only instructions. Windows can almost certainly be made to work but I don’t have the facilities to test.

Enter the path to the script you wish to run in the Post Script entry box in the export dialog or browse to the script using the Browse for Script button above the entry box. If you wish to pass parameters, for example a border width or email address, to the script enter them, separated by commas, into the Parameters entry box. Avoid new lines in the parameter list.

By default your script will be run by Bash. If you wish it to be run by anything else – Python, PHP, AppleScript – include a shebang at the top of the file with the full path to programme you would like to run it with. For example:

#!/usr/bin/python

def foo( arg ):
	print( arg )

When the plugin calls the script it includes parameters on the command line:

<script> PathToExportedImageFile commaSeparatedKeywordList commaSeparatedParameterList

Script Output and Debugging

Script stdout – bash ‘echo’, python ‘print()’ – and stderr is redirected to a log file named after the script file and placed in the same directory as the script. In MacOS you may also use system notifications:

From Bash:

osascript -e 'display notification "Hello world!" with title "Hi!"'

Or from AppleScript just:

display notification "Hello world!" with title "Hi!"

If the script returns non-zero then an error box is displayed containing the contents of the output log.

Example Post Export Scripts

A set of example scripts are included with the plugin it the Scripts folder.

Border.bash

Adds a border to exported images using convert. You can add width & colour parameters in the BFEP dialog box, width followed by colour. Width is a percentage of the image size, without the ‘%’ character. For colour see the convert colour documentation. Width defaults to 0.5 (thin), colour to black

Mailto.applescript

Mails the exported image somewhere. Parameters need to be given in the dialog Parameters box, sender, recipient, content in that order

Photos.applescript

Imports exported images into the Apple Photos app. I find this for posting images to Instagram.

By default exported images go into a BFEP album. A different album can be given in the Parameters entry box

Twitter.bash

Tweet an image. You’ll need Tweetbot installed for this. The script opens Tweetbot with a new tweet window open and the exported image attached ready for you to add text.

PadSquare.bash

Pads an image to square by adding padding equally to either end of the shortest edge. Padding colour defaults to white. Set your own colour by adding a parameter to the Parameters entry box. See  convert colour documentation for available colour parameters.