Last active
August 29, 2015 13:58
-
-
Save morganp/10111331 to your computer and use it in GitHub Desktop.
Lightroom Export Filter Plugin, Work in progress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Lightroom Lua Plugin for export filter | |
-- Page 49 to 51 of the SDK guide | |
-- http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/photoshoplightroom/pdfs/lr5/lightroom-sdk-guide.pdf | |
function SimpleExternalToolFilterProvider.postProcessRenderedPhotos( | |
functionContext, filterContext ) | |
-- Optional: If you want to change the render settings for each photo | |
-- before Lightroom renders it | |
local renditionOptions = { | |
filterSettings = function( renditionToSatisfy, exportSettings ) | |
exportSettings.LR_size_maxHeight = 400 | |
exportSettings.LR_size_maxWidth = 400 | |
exportSettings.LR_size_doConstrain = true | |
return os.tmpname() | |
end, | |
} | |
for sourceRendition, renditionToSatisfy in filterContext:renditions( | |
renditionOptions ) do | |
-- Wait for the upstream task to finish its work on this photo. | |
local success, pathOrMessage = sourceRendition:waitForRender() | |
if success then | |
-- Now that the photo is completed and available to this filter, | |
-- you can do your work on the photo here. | |
-- It would look somethinglike this: | |
-- local status = LrTasks.execute( 'mytool "' .. pathOrMessage .. '"' ) | |
local status = 1 | |
-- use something like this to signal a failure for this rendition only: | |
-- (Replace "error message" with a user-readable string explaining why | |
-- the photo failed to render.) | |
if status ~= (desired status) then | |
renditionToSatisfy:renditionIsDone( false, "error message" ) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment