# Lff help creating script for autostacking brackets



## Cornelisk (Jul 2, 2018)

Hi,

I'm looking for someone with some lua coding experiance to help me out with some LR automatisations. Proffesionals are welcome, they can contact me via PM!
What I'm basily looking for as a better way to stack brackets than the autostack by capture time option.

I would think you could stack based on EV rating in stead of pure time based stacking. Brackets in my case always start with a picture with EV0 followed by 2 or op to 8 images that also have an EV other than 0. The next picture with EV0 is the next group or single image.

Or is this more complicated?


----------



## johnbeardy (Jul 2, 2018)

It is a bit more complicated.....

I have actually been looking at this recently. As far as I can see, LR doesn't let scripts/plugins stack images that are already in the catalogue. If it did, the autostacking would be relatively simple. 

One workaround would be for the Lua to send keystrokes such as Cmd G to the operating system, but I have found this to be very flaky indeed.

The only access to stacking is in an API function which imports pictures - it lets you import pictures and define if they should be stacked.  So one would have to call Exiftool to query the EXIF of un-catalogued images in a folder, determine which should be stacked together, then import and stack the groups. Apart from adding to the complexity of the code, there's a nasty timing issue - the Lua engine only knows when it has sent the query to Exiftool, not when Exiftool has completed processing the image. So the code needs to be adapted to wait and figure out when Exiftool has finished. It all makes the task messier than it needs to be.


----------



## BarrySchwartz (Jul 2, 2018)

I use a plugin called Enfuse from The Photographer's Toolbox, which allows for batch processing through stacks (although since I don't use it, I can't say how it works!).  However, Enfuse allows me to make completely different adjustments to each photo in advance of blending (such as color temperature, dodging and burning, cropping, straightening, and seemingly everything else), which you cannot do using the LR HDR, which will only blend images as-is.   As an architectural photographer, this is an essential part of my workflow.


----------



## Cornelisk (Jul 2, 2018)

BarrySchwartz said:


> I use a plugin called Enfuse from The Photographer's Toolbox,



Barry, I also use LR enfuse. But what I'm after is that I can simply import a days worth of rep photo's and that a  script sorts them out and run Enfuse where needed.




johnbeardy said:


> It is a bit more complicated.....


I was affraid this was going to be the conclusion. Is there a way Bridge can fill the gap? Run a stackingscript in bridge and use the .bridgesort as a base of the LR grouping script. (Don't know if the bridge autostack HDR/pano took is any good)

Run LR group script -> userinput what folder files are in-> open  bridge on folder where files are located -> run bridge script to autogroup brackets -> LR script uses the info in the .bridgesort file to determine stacks -> import photo's in stacks

Just thinking out loud here.


----------



## johnbeardy (Jul 3, 2018)

I have never looked at the format of the .bridgesort file, but maybe it does group items without the hassle of Exiftool.

On the other hand, I would always try for a Lightroom-only method. One might import files into LR normally, and then run a script which analyses their EV etc and stores the filenames in memory.  The user would then remove them from LR, and run a second script which imports and stacks them.  

It's clunky but doable, but some kind of UI might be needed. For example, one of my cameras only allows 1 stop bracketing, so stacks are bigger than another that goes up to 3.  Maybe there should be a variable for the EV interval? And what if the photos aren't listed in capture time order.

It's all pretty messy, and yet would be so simple if we could get Adobe to allow scripts to stack or run merges!

John


----------



## LouieSherwin (Jul 3, 2018)

Cornelisk said:


> Hi,
> 
> I'm looking for someone with some lua coding experiance to help me out with some LR automatisations. Proffesionals are welcome, they can contact me via PM!
> What I'm basily looking for as a better way to stack brackets than the autostack by capture time option.
> ...



Check out  Jeffrey Fridel’s “Bag-o-Goodies” Lightroom Plugin. The Find Next Photo Group option gives you several different grouping options. However, he points out that the LR API doesn't allow stacking so you have to apply the stack manually.  But the tool is setup to step through a set of images so that by assigning a keyboard short cut to the plugin you could quickly process a Folder of images.

-louie


----------



## Cornelisk (Jul 4, 2018)

LouieSherwin said:


> Check out Jeffrey Fridel’s “Bag-o-Goodies” Lightroom Plugin.



Thanks Louie, This plugin works great, I'm trying to throw something together with winautomator to record some macro's to automise this. But it is quite slow. I just have to find a variable to stop the procces when all photo's are grouped to tidy it up a bit.

Setup I have now is:
I import my photo's on my mac to a location on Nas and duplicates to a hotfolder on a windows machine
Windowsmachine runs Jeffreys folder watch on this hotfolder and import's the duplicates automaticly
I then run de winautomationmacro that basicly runs JF's "Find Next Photo Group" and ads CTRL G in an infinite loop
Error happens when all photo's are grouped and I abort the loop
After that I select all stacks an run Enfuse
After enfuse is done I export tiffs to Nas where orignals raws 
Import on my mac in same catologue as original Raws
Edit

I would like to streamline this proces further. First step would be to find a way to make the loop stop and run enfuse automatically.
Idealy this would al happen in the background without any user interferance, maybe Ill get there some day .


----------

