Exporting multiple different sizes from Lightroom

[Update 17/2/2012: Modified the script slightly to fix a path capitalisation bug]

[Update 22/3/2013: Re-recorded the video to explain the process better]

I've been shooting a lot of model sessions lately and one of the things I always need to do after these sessions is put the processed pictures into my dropbox where the model can see them. These pictures are for a variety of different uses including Facebook, 500px, Google+, various modelling sites and, of course, print publication. 

These sites often have different size limits and requirements so I usually need to export versions with and without watermarks and at various different pixel dimensions. So it's always been a pain in Lightroom that I can only export images at one size. Here's what I export by default: 

  • full-size clean
  • full-size watermarked
  • 2000px watermarked
  • 1000px watermarked

That's 4 separate exports and of course I have a preset for each. It's not a *lot* of work but all those clicks bug me so I set about finding a way to export multiple different sized versions in one step. I tried a number of different approaches but the one I settled on was to write an application. Steady-on, it's not as scary as it sounds. My plan was to set up an export preset to save a full sized watermarked version then my application, called automatically from Lightroom, would take that full sized version as input and create 2 more smaller versions and save them in the same folder. The problem now, was writing the application. 

I'm on a Mac so I started looking at Automator and when that proved too limited I looked at Applescript and when that proved too hard to debug I did what any reasonable, right thinking person would do and started whining on Twitter. I have a background in programming so surely I could accomplish this apparently simple task but no, I'd wasted a whole day on this so finally I asked for help. And to my great joy a couple of people did try. I posted my broken Applescript on pastebin in a huff and the next morning John Day (@johneday on twitter) had completely rewritten and simplified it for me. Thank you so much John - you're a superstar. Here's the script he wrote for me:

on open of myFiles
	set newSizes to {1000, 2000}
	repeat with aFile in myFiles
		set filePath to aFile's POSIX path
		set bPath to (do shell script "dirname " & quoted form of filePath)
		tell application "System Events" to set fileName to aFile's name
		repeat with newSize in newSizes
			do shell script "sips " & quoted form of aFile's POSIX path & " -Z " & newSize & " --out " & quoted form of (bPath & "/" & rename(fileName, newSize) as text)
		end repeat
	end repeat
end open

on rename(fName, fSize)
	do shell script "sed 's/fullsize/" & fSize & "/' <<< " & quoted form of fName
end rename

If you'd like to use this yourself run "Applescript editor" on your mac, create a new script and paste the above code into the code window. Then from the file menu choose save and be sure to save this as an Application, not a script. There's a drop-down box in the save window that lets you choose to save as Application. Save it in a folder somewhere and that's it, you're done. You just wrote an application. Congratulations - you're a programmer now. :)

Finally create your Lightroom export preset to save a full sized version, watermarked or not as you prefer. Then look at the bottom of the export dialog. You can choose post-processing actions. One of those is "Open in other application..". Pick that and then just below you can choose which application to use. Simple. Set your new application as the post-processing action and you're done. If you want other sizes instead of my 1000px and 2000px versions you can just modify the numbers in the line near the top of the script where it says, "set newSizes to {1000, 2000}". Add as many sizes in there as you like, comma separated.

So this solution is not mine at all. This is all down to John Day. If you find this useful please follow John on twitter (@johneday) and check out his website at https://www.johneday.com/

This is obviously a mac only solution but writing something similar should be quite easy on Windows. SIP, the Scilab Image Processing toolkit, is pre-installed on the Mac but it's free and available for windows too. So is ImageMagick, which does similar stuff. All that's needed is a little code to wrap that up written in C#, Python or even a DOS batch file. Let me know if you do something like that and I'll be delighted to add links to it from here.

PW187 - Exporting multiple different sizes from Lightroom