Script for deflickering and ramping ACR (.xmp) settings in Bridge

Started by dmilligan, October 17, 2013, 12:32:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


This script is for deflickering and ramping pretty much any ACR setting from Adobe Bridge over a sequence of images


Script download:

Place this script in:
%APPDATA%\Adobe\Bridge CC\Startup Scripts\
~/Library/Application Support/Adobe/Bridge CC/Startup Scripts/

to have it automatically load on startup (or you can just double click it or open it with Bridge when you want to use it). It will add three new items to the context menu 'Ramp...', 'Ramp Multiple...' and 'Deflicker...'

Simply select all the images you want to ramp, right click, go to 'Ramp...', 'Ramp Multiple...' or 'Deflicker...' and fill out the dialog.

'Ramp Multiple' ramps the existing ACR settings that you select from the first image to last (kind of like a smart version of the 'Synchronize' in the ACR dialog). You can also specify keyframes by rating them 1 star. It will ramp settings from one keyframe to the next. The first and last images are considered keyframes even if not marked. The deflicker will use keyframes marked like this as well.

This script is useful for timelapse as well as RAW video. There's an "additive" mode so you can add to the existing value (useful for modifying the exposure value calculated by ML Post Deflicker, easier than the exif tool way, and you can make it ramp as well)

There's also a version of this script for Lightroom:



Sounds very interesting.  I have windows ACR 8.2 and Bridge CS6.  Is there any way I can use it?  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X


yeah it should work fine in cs6, just change that path to ...\Bridge CS6\Startup Scripts


Sounds very promising. Gonna try asap. Thanks for contributing


Quote from: RenatoPhoto on October 17, 2013, 02:31:03 PM
Sounds very interesting.  I have windows ACR 8.2 and Bridge CS6.  Is there any way I can use it?

Ok found the startup scripts here:

C:\Users\RE\AppData\Roaming\Adobe\Bridge CS6\Startup Scripts

Copied the script
Paste to notes and saved it as BridgeRampingScript.jsx
Placed a copy in : C:\Users\mycomputername\AppData\Roaming\Adobe\Bridge CS6\Startup Scripts
Opened Bridge and asked me if I wanted to load the script.  Clicked yes
Selected a group of images I wanted to change the exposure
Right mouse click and selected "Ramp ACR Settings"
On the drop down menu you can select any of the xmp settings, default "Exposure2012"
In Start I entered -2
in End I entered 0  (This will ramp my exposures starting at -2 and ending at 0)
Clicked additive
click ok

Whala!  All of the xmps where succesfully modified and ramped to my taste.

Nice script!  Thanks and great work.  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X


Sounds like solving the missing piece of the timelapse puzzle. Gonna try on my mac tomorrow


So I'm actually close to getting this script to be able to do deflickering itself, I just need a little help with some Maths. I've managed to pull a bitmap of the Bridge preview (it's lowres, 8bit, but should be enough info to do the deflicker I think, also that helps speed b/c this is a script not native code) and generate a histogram from it from within my script. This entire process takes about 1-2s, so I think this should actually be feasable in terms of speed since that's the vast majority of the computation. It's certainly less time than it would take to have it load the entire image in photoshop and use photoshop's histogram data.

So now what I'm assuming I need to do is calculate where some target percentile is on the histogram (should be easy). Then calculate how far I need to move that to get it to some target level, and convert that to EV.

For example, let's say my target percentile is 50% and the target level is 127. I calculate the histogram and find that 50% is at 143, so now I know I need to shift left by 16. So how do I compute that as EV from an 8 bit (0-255) value? Am I on the right track at all here?

I found the function used by ML post deflicker called raw_to_ev, it basically does the following calculation: ev = -log2(raw_max) + log2(raw_value). Is that all I need to do?


You need to compute it either in raw or 16-bit linear space, or know the curve somehow.

log2 is a very crude approximation of this curve.


so should I just reverse engineer the curve in 8 bit space, like take a blank white image apply a bunch of different EVs to it and do a logarithmic regression on the data points? Or is it just not feasible to try and calculate with 8 bit data?


Yes, if the "picture style" is always the same, this should work.

To simplify things, you may want to convert the image to grayscale first. For reversing, I think it's enough to render some image at say -0.5 and +0.5 EV (or maybe even smaller) and recover the curve from there, but I'm not sure if the accuracy is enough.

Some theory:

Also look at the older bulb ramping algorithm: it reversed Canon curve on the fly in order to compute the EV from it. Should be exactly what you are looking for.



It's working!!!

So what I ended up doing was using the tone curve instead of trying to calculate exposure adjustment. The tone curve is specified in 0-255 values so no conversion is needed. I computed the values of several various percentiles (25,50,75 perhaps more or a better selection would work better?) on a reference image, then those become the y values of the tone curve with the image's percentiles values as the x.

It seems to be working, I haven't had much of a chance to test and put it through it paces yet.

Any suggestions?


hats of to you. Can,t wait to try it out. See if I get up to do I night to day timelapse tonight


Is it possible to do any of this in Lightroom? I only have old versions (CS3) of bridge. Could it work in CS3 Bridge and then Lightroom can read the fixed .xmps?


I tried it with CS3 and got an error:

"An error occurred while running a startup script named 'BridgeRampingScript'. It may not be compatible with this version of Bridge;

Error in C:\Users\me\AppData\Roaming\Adobe\Bridge CS3\Startup Scripts
Line 4: <!DOCTYPE html>
Variable or value expected


Sorry, wish I could help you, Lightroom does not have scripting support and I don't have CS3. The script will probably work as far back as CS5, but that's about it.


I've added a couple more percentile levels and tried to optimize their distribution.

Skipping lines to speed things up a little

Deflicker now ramps from the first image selected to the last image selected. (initially it just tried to make all the images look like the first one). This should help for scenes where the lighting changes dramatically (i.e. sunset, sunrise). If you have a scene with a pretty static period, then a transition (such as some amount of night sky then a sunrise), you might want to select and deflicker the static period, then select and deflicker the transition separately, so the ramping is smoother, or you may not need to deflicker the static period at all, in which case only deflickering the transition will save you time.

You should be able to use some amount of the various controls that are known for causing flicker such as clarity and highlights, just apply those settings first to non-deflickered images, then run the deflicker.

If you need to rerun the deflicker make sure you clear the tone curve from all images before hand or the script will calculate the tone curve to apply incorrectly (since there is already one being applied).

I've got some before/after sample videos rendering at the moment, will post them soon.


var percentiles = [0, 0.3, 0.5, 0.75, 0.95, 0.99, 1.0];

Are you sure? This is no longer statistically robust, try to stay close to the median.


I have no idea what should work, just trying things, what would you suggest? only the median?


I'd say try a few percentiles and choose the one that crosses the middle of the sky (roughly).


Maybe I need a UI with a preview like you showed me with the percentile highlighted and let the user pick.


Yeah, that would be perfect. You can try the 2.3 version to see a UI that lets you select a percentile; something like that would be good IMO.

What I'd like to try is to use the median of the difference between images. I'm using it in dual ISO for matching brightness line-by-line; you can see the result here:

(look at horizontal banding)


okay, so I dropped trying to use the curve to deflicker and using exposure instead.  ev = 2 log2(x) seems to be a pretty decent approximation. You can now run several passes of the deflicker, it should get better each time (basically each iteration is reducing the error between ev = 2 log2 (x) and what ACR exposure is actually doing). After about 3 passes it's just about perfect. Percentile is now user selectable, I'm working on a percentile preview (image manipulation in scripting language may prove to be just to slow, we'll see).