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:

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:

  1. Make sure Python is installed on your system
  2. Save the above script as "mail-to.py" and put it in the Export Actions folder for Lightroom
    1. Win: C:\Documents and Settings\yourname\Application Data\Adobe\Lightroom\Export Actions
    2. Mac: /[user home]/Library/Application Support/Adobe/Lightroom/Export Actions/
  3. 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:

  1. In Lightroom, go to File > Export
  2. Configure export parameters as needed
  3. 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.

Personal tools