Lightroom Export Actions
From Payne.org Wiki
This page contains notes on using Export Actions in Adobe Lightroom.
Any file or shortcut placed in the Export Actions folder will show up as an option for "Post processing" after exporting images. This makes it easy to link in additional processing steps for images (such as emailing or uploading) after they're exported from Lightroom. Additional steps can be implemented by existing apps (e.g. PhotoShop droplets), client uploaders for major services (e.g. Smugmug, Flickr).
Or, you can write your own custom scripts.
References:
- Adobe documentation on post-processing actions
- Lightroom Journal blog post on post-processing actions
- Notes on exporting to Flickr
Custom Script Details
The file (or shortcut reference) put in the Export Actions folder must be an executable. After exporting, Lightroom will invoke the selected export action with the exported image path names as command-line arguments.
To automatically send my exported photos to a lab for printing, I used the following Python script. This script sends an email for each exported image, with the image as an attachment:
import sys,smtplib,os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
from email.Utils import COMMASPACE, formatdate
from email import Encoders
from_email = "YOUR-EMAIL"
to_email = "EDIT-THIS"
smtp_server = "YOUR-SERVER"
def send_mail(send_from, send_to, subject, text, files=[], server="localhost"):
assert type(send_to)==list
assert type(files)==list
msg = MIMEMultipart()
msg['From'] = send_from
msg['To'] = COMMASPACE.join(send_to)
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = subject
msg.attach( MIMEText(text) )
for f in files:
# Open the files in binary mode. Let the MIMEImage class automatically
# guess the specific image type.
fp = open(f, 'rb')
img = MIMEImage(fp.read())
fp.close()
msg.attach(img)
smtp = smtplib.SMTP(server)
smtp.sendmail(send_from, send_to, msg.as_string())
smtp.close()
# -------------------------------------------------------------
#
# Send each image as an individual email
#
print "Emailing photos to %s" % to_email
for filename in sys.argv[1:]:
print "Sending %s ... " % filename
send_mail(from_email, [to_email], "Lightroom export",
"Lightroom export", [filename], smtp_server)
input("[All Done]")
To set up this export action:
- Make sure Python is installed on your system
- Save the above script as "mail-to.py" and put it in the Export Actions folder for Lightroom
- Win: C:\Documents and Settings\yourname\Application Data\Adobe\Lightroom\Export Actions
- Mac: /[user home]/Library/Application Support/Adobe/Lightroom/Export Actions/
- Edit the marked sections: your from email address, recipient address, and SMTP server
At this point, your script should show up as a post-processing option in Lightroom:
- In Lightroom, go to File > Export
- Configure export parameters as needed
- Select your "mail-to" script in the Post Processing section
For even easier use, you can save your configuration as a "User Preset". Just select "add" in the Export panel after setting up the configuration. Your preset will now show up under File > Export with Preset.