I watermark my photos in my photoblog using a little script (yes, I know this…). My workflow so far was
- export the photos from Lightroom
- open finder, go to the export directory
- open a shell in the directory
- run my watermark-script for the exported pictures
Well, this is annoying. But there is a gentle solution: Platypus! This great piece of software turns every Shell/Python/Perl/Whatever script into a little Mac-Application which can be used as export action in Lightroom.
To create your own export action using Platypus, just open the application and point it to the script path using the „Select“ button. Platypus is smart and will fill in more essentials:
Now press the „Create“ button and select the Lightroom Export Actions directory. It is usually
/Users/yourname/Library/Application Support/Adobe/Lightroom/Export Actions
Open Lightroom, select the pictures you want to export and press the Export-button (or Command Shift E). At the bottom of the export dialog you find the postprocessing options. The „after export“ combobox should now display the newly created export action:
Now press „export“ and watch what happens:
That’s it. Great isn’t it? 🙂 Here is my watermark-script. It needs exiv2 and imagemagick:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #!/usr/bin/python import sys import re import os import subprocess import string import shutil # path exiv2 executable EXIVBINARY="/usr/local/bin/exiv2" # path composite executable (from imagemagick) COMPOSITEBINARY="/opt/local/bin/composite" # watermark image WATERMARKFILE="/Users/melle/Pictures/watermark/Watermark2.png" for filename in sys.argv[1:]: if not os.path.exists(filename): print filename + " does not exist!" continue # extract some strings from the filename pathRe = re.compile( '^.*\/') plainFilename = pathRe.sub( '', filename) baseFilename = string.replace(plainFilename, ".jpg", "") newFilename = "mark_" + plainFilename newMetaFilename = "mark_" + re.compile('\.[jJ][pP][gG]').sub('.exv', plainFilename) print "Tagging " + plainFilename # get the path - if available m = pathRe.search(filename) if m: pathname = m.group() else: pathname = "" # backup metadata to exv-file p = subprocess.Popen(EXIVBINARY + " -f ex \"" + filename + "\"", shell=True) sts = os.waitpid(p.pid, 0) # mv "$BASENAME.exv" "$NEWMETAFILENAME" shutil.move(pathname + baseFilename + ".exv", pathname + newMetaFilename) # add watermark p = subprocess.Popen("/opt/local/bin/composite -unsharp 2.0x1.4+0.6+0.05 -dissolve 30 -gravity southeast -geometry +25+25 \"" + WATERMARKFILE + "\" \"" + filename + "\" \"" + pathname + newFilename + "\"" , shell=True) sts = os.waitpid(p.pid, 0) # restore metadata p = subprocess.Popen(EXIVBINARY + " -f in \"" + pathname + newFilename + "\"", shell=True) sts = os.waitpid(p.pid, 0) # delete metadatafile os.remove(pathname + newMetaFilename) # open file in finder (mac only) p = subprocess.Popen("/usr/bin/open -a Finder \"" + pathname + "\"", shell=True) |