Copying - Applying Styles and Lens Adjustments
I have a script that will sync info between file formats. Variant have styles, lens correction, and multiple LCC attributes.
I can copy-apply adjustments.
The Capture One dictionary says Styles is a list of strings, the LCC attributes appear to be booleans, and lens correction appears to be a class of things called lens correction settings.
If I am syncing from a DNG back to an original camera native RAW file (ie. DNG to CR3, DNG to NEF, etc), should I code to sync these items? How do I reference them? I don't seem to be able to directly "set" them. For example these statemens fail.
set targetVariant's lens correction to sourceVariant's lens correction
set targetVariant's styles to sourceVariant's styles
For styles on the background layer do I need to apply each sourceVariant's style to the targetVariant's background layer?
What do I do for lens correction and LCC values?
-
After some fiddling around, I found that the following code works to copy adjustments and layers between variants of two RAW images of the same camera.
I haven't checked how this works for variants of different format or different cameras
It copies the LCC and the distortions settings (I didn't try the other lens correction settings).
If there are already layers in Variant 2, these are kept. You can end up with two layes with the same name in Variant 2.
The copied adjustments remain on the application adjutsment clipboard.
I haven't checked how the manual selections of copy fields on the adjustment clippboard interact with the Apple script commands
tell application "Capture One" to tell current document
set V1 to get (first variant whose selected is true)
set V2 to get (second variant whose selected is true)
set NL1 to name of layers of V1
set NL2 to name of layers of V2
copy adjustments V1
apply adjustments V2
end tell0 -
Thanks Eric. You can take a look at this script. It does a good job of copying things between different formats. I removed the things that didn't work. The link goes right to the lines where things are copied from source to target.
The script does exactly what it advertises. The lens corrections, LCC settings, and styles are not copied because 1) I'm not sure I should be copying them, and 2) I don't know how to code it.
Another item I am unable to code is keystone corrections. It seems these are not available via AppleScript?
The purpose of the script is to "sync" things back to camera native raw files when one has been forced to use DNG derivatives because the native camera raw files are not yet supported (for example the EOS R5 Mark II took a few weeks). I even used it to sync metadata, ratings, labels, keywords from JPEGS back to raw files I found on old DVDs with no adjustments.
One caveat is the script doesn't deal with multiple variants of the same picture but I have thoughts on how to do that .. create a target variant for each source variant that matches based on parent image EXIF data.
0 -
This seems to work for styles and lens settings. I still need to look at LCC.
tell application "Capture One" to tell current document
set V1 to (first variant whose selected is true)
set V2 to (second variant whose selected is true)
set V1styles to styles of V1
if (length of V1styles) > 0 then
repeat with theStyle in V1styles
tell V2 to apply style first layer named theStyle
end repeat
end if
set lens profile of lens correction of V2 to lens profile of lens correction of V1
set chromatic aberration of lens correction of V2 to chromatic aberration of lens correction of V1
set custom chromatic aberration of lens correction of V2 to custom chromatic aberration of lens correction of V1
set diffraction correction of lens correction of V2 to diffraction correction of lens correction of V1
set hide distorted areas of lens correction of V2 to hide distorted areas of lens correction of V1
set distortion of lens correction of V2 to distortion of lens correction of V1
set sharpness falloff of lens correction of V2 to sharpness falloff of lens correction of V1
set light falloff of lens correction of V2 to light falloff of lens correction of V1
set focal length of lens correction of V2 to focal length of lens correction of V1
set aperture of lens correction of V2 to aperture of lens correction of V1
set tilt of lens correction of V2 to tilt of lens correction of V1
set tilt direction of lens correction of V2 to tilt direction of lens correction of V1
set shift of lens correction of V2 to shift of lens correction of V1
set shift direction of lens correction of V2 to shift direction of lens correction of V1
set shift x of lens correction of V2 to shift x of lens correction of V1
set shift y of lens correction of V2 to shift y of lens correction of V1
end tell0 -
I found that when I created a (horrible) LCC for V1 it was copied to V2 by the Apply Adjustments command
1 -
Script Editor says this code is OK but it gives an error on the command to "apply LCC sourceVariant to targetVariant". I imagine it is because I don't know well how to use LCCs. Will try more later.
if applied LCC name of sourceVariant is not missing value then
apply LCC sourceVariant to targetVariant
set LCC color cast of targetVariant to LCC color cast of sourceVariant
set LCC dust removal of targetVariant to LCC dust removal of sourceVariant
set LCC uniform light of targetVariant to LCC uniform light of sourceVariant
set LCC uniform light amount of targetVariant to LCC uniform light amount of sourceVariant
end ifThanks for the help!
0 -
Walter Rowe I just had a look at your script library in github. Very nicely done (and thanks for the references!)
0 -
Thanks Eric Valk for the compliment. It became clear to me once I had enough scripts, all with the same set of handlers attached to them, that keeping those handlers updated across so many scripts was unwieldy. Making a library of handlers made more sense. I then realized I needed to make this seamless for the user so I made a handler in each script that downloads and compiles the library for them. If it cannot download the library, then it looks to see if one has been downloaded previously. If it has then it just loads the one already on the system.
I also made a template app with sections for defining app-specific properties and inserting app-specific code, and I made a template README. These will serve as the basis for future scripts I create.
The library itself also has its own "on run" handler that self-installs the library. I did this so people could grab the library and any script installer and place them on "offline" systems. First download and install the library, then grab any of the other scripts and install them.
I believe in giving credit to others when they've provided the idea or code.
0
Post is closed for comments.
Comments
7 comments