Skip to main content
shawnh97010311
Known Participant
April 15, 2022
Question

SDK Question - Match Total Exposure

  • April 15, 2022
  • 1 reply
  • 2923 views

Hey all! 

 

Looking for a little insight into the SDK regarding Match Total Exposure. Anyone know of a way to utilize Match Total Exposure within the SDK? Specifically for replicating the Match Total Exposure effect on a set by set basis automatically. Thanks for the insight. 

This topic has been closed for replies.

1 reply

johnrellis
Brainiac
April 15, 2022

Match Total Exposures adjusts the target photo's Exposure develop setting so that its effective exposure value is the same as that of the source photo.  Below is the code my Any Filter plugin uses for computing exposure value (EV) and effective exposure value.  You can get the shutter speed, aperture, and ISO using photo:getRawMetadata().

--[[----------------------------------------------------------------------------
public number 
ev (number shutterSpeed, number aperture, number iso)

Returns the exposure value of the shutterSpeed, aperture, and iso, or nil
if any one of them is nil.
------------------------------------------------------------------------------]]

function ExposureValue.ev (es, shutterSpeed, aperture, iso) 
    return (shutterSpeed and aperture and iso) and 
        log2 (aperture ^ 2 / shutterSpeed) - log2 (iso / 100) or nil
    end
    
--[[----------------------------------------------------------------------------
public number 
effectiveEV (number shutterSpeed, number aperture, number iso, 
    string processVersion, number exposure2012, number exposure)

Returns the effective exposure value, taking into account the additional
stops of the Develop setting "exposure2012" (if "processVersion" is "6.7")
or "exposure" (if "processVersion" is earlier).  Returns nil if any of the
arguments actually used to compute effective EV are nil.
------------------------------------------------------------------------------]]

function ExposureValue.effectiveEV (es, shutterSpeed, aperture, iso, 
        processVersion, exposure2012, exposure) 
    local processVersionNum = tonumber (processVersion) or 0
    local exp = processVersionNum >= 6.7 and exposure2012 or exposure
    return (shutterSpeed and aperture and iso and exp) and 
        ExposureValue.ev (es, shutterSpeed, aperture, iso) - exp or nil
    end
    

 

shawnh97010311
Known Participant
April 15, 2022

John,

 

Thank you again for your help. And just for my clarity, is this code affective for locating exposure for each photo in a set of images to ultimatley match the visual exposure of an 'anchor' image? I just want to make sure we are on the same page with the intended outcome. You've been a huge help. Thank you! 

johnrellis
Brainiac
April 19, 2022

John,

 

Just wanted to thank you again. We've found our solution through some trial and error. All the best! 


Just curious, what was the approach you took?