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.

BearBar

A menubar assistant for Bear, the MacOS note taking app, a lightweight applet for MacOS that sits in the menubar that lets you:

  • Quickly append text to any Bear Note
  • Optionally add a named hashtag with the appended text if the note doesn’t already contain the hashtag
  • Define a global hotkey to append the contents of the clipboard to the named Bear Note from any app
  • Define a global hotkey to append the contents of the clipboard into BearBar’s text input window from any app.

Download & Installation

  • Download the BearBar binary here
  • Unzip (double click)
  • Copy to your Applications folder
  • Run

Automatically Start on Login

Add BearBar to your login items in System Preferences->Users & Groups->Your Name->Login Items.

Problems, Suggestions, Pizza

Please use the contact form on this site to contact Kim or add a comment at the bottom of this article.

Lightroom 7.3d preset sort order fix

Lightroom 7.3 release created a problem with preset sorting caused by differing title/internal name fields in the preset. This plugin fixes this by copying the internalName field to the title field.

Precautions

The plugin doesn’t actually modify existing files or folders, it makes copies but you should back up your presets before running it.

Use:

  • !!! **Backup the preset folder you’re about to fix** !!!
    the plugin doesn’t alter any of the files it’s fixing but … !! be safe !!
  • Download the archive & unzip
  • install the plugin using the LR plugin manager.
  • Run the plugin from File->Plugin-Extras->Fix 7.3 preset order problem
  • Choose a folder full of presets in the presented file browser
  • Plugin creates a mirror of the preset folder in `’Fixed \<folder name\>’` adjacent to the folder being fixed containing the fixed presets.
  • swap over the names of the fixee and fixed folders
  • Restart Lightroom.
  • Boom!

Caveats:

The fix relies on presets being, esseintially, Lua code. It uses loadstring() and pcall() to eval the preset code, fixes the internalName field before saving the file into the fixed folder. Some of Adobe’s supplied preset files won’t fix using this method, apparently because the title field is of the form title = ZSTR “$$$/AgDevelopModule/Templates/BWFilter/BlueFilter=Blue Filter” and pcall fails. Files which won’t fix are simply copied to the fixed folder as is. So far this hasn’t presented a problem and the sorting for these files seems OK. Let me know if it does.

Windows.

This plugin hasn’t yet (8/4/2018) been tested on Windows, I don’t have the facility. It should work but I can’t be sure. I’d appreciate it if a windows user could check for me that it does, or doesn’t.

Issues.

Please contact me with issues, problems, pizza, praise using the BuggeringAbout.com contact page. I’ll do my best to help wherever I can.

License

(c) Kim Aldis 2018

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.

Kim Aldis | www.buggeringabout.com | www.kim-aldis.co.uk