June 11, 2013

Opening external applications in Lightroom

Adobe Photoshop Lightroom, or simply just Lightroom, is one of the most popular photography applications for PC or Mac.  Not very expensive (price dropped recently below 100 UKP), Lightroom provides an integrated set of tools covering the most common needs of many photographic workflows.

However, there may be situations where Lightroom is not enough. In these cases, third-party applications can come to the aid. A few examples? You may want to use your preferred raster editor, or maybe you would like to have a closer look at a few metadata not managed by Lightroom using an external metadata editor, or you may want to switch to a different RAW converter, or simply view the photos using an external viewer which is much faster than Lightroom.

Like many other Digital Asset Managers, Lightroom can be easily configured to open an image with an external application. After setting your preferences, the name of the external application will appear in the main menu.



The fact that Adobe named this "external editing" shall not mislead you. Any external application can be invoked in this way.

Just select one (or more than one) image in Lightroom's Grid View, then select in the main menu

Photo / Edit In / Name of Your External Application

and the image (or the images) will be magically opened in your external application.

However, there are a few issues.

First, before opening the external application, Lightroom presents several choices.
You have the option to open the original image file, or to open a copy of it, or to open a rendered copy (i.e. obtained after applying Lightroom adjustments).


These options may have a sense if you are going to edit the image outside Lightroom. But if you just want, for instance, examine metadata with ExifToolGUI, or view your images with Fast Picture Viewer, only the "Edit Original" choice is relevant.

Another problem arises when you try to open a RAW image in an external application. In this case, the only available option is to "Edit a Copy with Lightroom Adjustements".


So, it seems not possible to directly open a RAW file from within Lightroom using a third-party RAW processor, like DxO or Nikon Capture NX2, for instance. Quite annoying indeed!

You could say "why the hell you want to use DxO if you already have Lightroom?". The fact is that Lightroom is not just a parametric editor, like DxO.
Lightroom is an all-in-one application which includes the Library, which is a Digital Asset Manager (DAM).
Typically, a desktop DAM is at the centre of the photographic workflow.
That means that the integration with other applications is of key importance. Other DAMs, like for example IDImager/Photo Supreme, allow to easily do this, without going through file copies or other operations.

Fortunately, there are a few workarounds.

1 - use Windows Explorer


In Lightroom, select the image you would like to open with an external application and press Control + R.
This will open Windows Explorer in the same folder of the image, with the image file automatically selected. At this point you will be able to open the image with any application, directly from the Explorer menu.

2 - use a plugin


Another solution is using a Lightroom plugin. You can try and buy a ready-made plug-in, like Opendirectly by John Beardsworth, or write your own.
Plugins are written in Lua programming language and the Lightroom Developer Center provides plenty of documentation and examples.
In order to create a simple plug-in for opening an image in DxO, you have to create a folder, named for instance openwithdxo.lrplugin.
In that folder you have to put 3 files:

1) a Manifest file info.lua :



--[[--------------------------------------------------------------------------

info.lua

Allows to open an image with an external program. Useful to bypass the

"Edit with" dialog which prevents opening RAW files with external editors.

Author: Maurizio Agelli, 2013

------------------------------------------------------------------------------]]

return { LrSdkVersion = 4.0,

             LrToolkitIdentifier = 'openWithDXO/com.maurizioagelli',

             LrPluginName = LOC "$$/MaurizioAgelli/PluginName=MaurizioAgelli", 



            -- Info for the Plug-in Manager

            Dialog LrPluginInfoProvider = 'PluginInfoProvider.lua',

           -- Create a new menu item in the Library menu.

            LrLibraryMenuItems = {
                                   {
                                      title = LOC "$$/MaurizioAgelli/CustomDialog=Open with DxO Optics Pro",

                                      file = "OpenWith.lua",

                                      enabledWhen = photoSelected,

                                     },

                                   },

           VERSION = { major=0, minor=1, revision=0, build=0 },

}


2) a file PluginInfoProvider.lua :

--[[----------------------------------------------------------------------------
Info for the Plugin Manager.
------------------------------------------------------------------------------]]

local function sectionsForTopOfDialog( f, _ )
   return {
             {
title = LOC "$$$/MaurizioAgelli/PluginManager=MaurizioAgelli",
f:row {
spacing = f:control_spacing(),
f:static_text {
title = LOC "$$$/MaurizioAgelli/Title1=A simple plugin.",
fill_horizontal = 1,
               },
},
               },
  }
end

return {
sectionsForTopOfDialog = sectionsForTopOfDialog,
}

3) a file OpenWith.lua containing the main plugin code (the source code is the same as the script listed in the following section "use a script").

At this point you will be able to add your plugin using Lightroom's Plugin Manager. If everything is ok, the plugin name will appear under the "Plug-in Extras" entry of the Library menu.

3 - use a script


Scripts are an undocumented feature of Lightroom, which I discovered reading the Adobe forum. Scripts are not intended to replace plug-ins and I definitely do not recommend them for doing complex tasks which involve modifying the Lightroom catalog. You are going into nobody's land with scripts, use them at your own risk!

A script is just a single file containing a Lua program. It shall be put in a Scripts folder which shall be created into Lightroom's application data folder.
In Windows the script path should be something like:

C:\Users\YourUsername\AppData\Roaming\Adobe\Lightroom\Scripts\MyScript.lua

After restarting Lightroom, a new menu Scripts will magically appear in the menu bar, containing the entry MyScript
For instance, for opening an image in DxO, create a script "Edit in DxO.lua" with the following Lua code:
--[[----------------------------------------------------------------------------
    Open a photo with DxO Optics Pro from within Lightroom.
    Author: Maurizio Agelli, 2013
------------------------------------------------------------------------------]]

local LrApplication = import 'LrApplication'
local LrTasks = import 'LrTasks'
local catalog = LrApplication.activeCatalog()
local LrShell = import 'LrShell' 

local function openWithExternalProgram()
   -- edit the following line to change the external application path --
   local programPath = "C:\\Program Files\\DxO Labs\\DxO Optics Pro v8\\DXOOpticsPro.exe"
   local photo = catalog:getTargetPhoto()
   if photo ~= nil then
      local photoPath = photo:getRawMetadata('path')
      LrShell.openFilesInApp({photoPath}, programPath)
   end
end 

LrTasks.startAsyncTask(openWithExternalProgram, "openWithExternalProgram")

* * *

Using scripts, I customized my Lightroom installation, with the following external applications (on MS Windows 7):



  1. DxO Optics Pro, a powerful RAW converter and parametric editor (and a possible alternative to Lightroom's developer module);
  2. Picture Window Pro, my preferred pixel editor (I do not use or even own Photoshop);
  3. Nikon View NX2, the RAW converter which came with my camera (provides settings very close to those provided by the camera);
  4. Adobe Bridge, an image browser, residual of my trial installation of Photoshop (Photoshop trial has expired, but Bridge is still ok, I don't know why);
  5. a bunch of free metadata editors and viewers: Exif Pilot, ExifToolkitGUI, Microsoft Pro Photo Tools, PhotoME;
  6. Fast Picture Viewer, a very fast image viewer, very useful for culling and rating images.

No comments:

Post a Comment