Skip to main content
Known Participant
August 16, 2022
Answered

Script to automate geometry adjustments in camera raw

  • August 16, 2022
  • 2 replies
  • 916 views

I'm trying to write a script (vbScript based python app) to open jpeg images in a group of folders and apply the camera raw Auto geometry setting to each one, then save them in a new series of folders as jpegs.

I think I need something similar to this post but I can't adapt it for what I need. Any help would be apreciated.

 

Thanks

 

Steve

This topic has been closed for replies.
Correct answer Stephen Marsh

 

/*Camera Raw Filter - Transform Values:
1 = Auto, 2 = Full, 3 = Level, 4 = Vertical
*/
transformCRF(transValue = 1);

function transformCRF() {
    var actDesc = new ActionDescriptor();
    var transCode = charIDToTypeID("PerU");
    actDesc.putInteger(transCode, transValue);
    executeAction(stringIDToTypeID("Adobe Camera Raw Filter"), actDesc, DialogModes.NO);
}

 

Is there any jsx to execute the auto tone of camera raw ?

2 replies

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
August 16, 2022

 

/*Camera Raw Filter - Transform Values:
1 = Auto, 2 = Full, 3 = Level, 4 = Vertical
*/
transformCRF(transValue = 1);

function transformCRF() {
    var actDesc = new ActionDescriptor();
    var transCode = charIDToTypeID("PerU");
    actDesc.putInteger(transCode, transValue);
    executeAction(stringIDToTypeID("Adobe Camera Raw Filter"), actDesc, DialogModes.NO);
}

 

Is there any jsx to execute the auto tone of camera raw ?

Known Participant
August 17, 2022

Worked a treat! Thanks

Legend
August 16, 2022

try this:

var s2t = stringIDToTypeID;
var d = new ActionDescriptor();
var d1 = new ActionDescriptor();
d.putPath(s2t("null"), new File("D:\\_MG_8610.CR2"));
d1.putInteger(s2t("PerU"), 1);
d.putObject(s2t("as"), s2t("Adobe Camera Raw"), d1);
executeAction(s2t("open"), d, DialogModes.NO);
Known Participant
August 16, 2022

Thanks for that snippit. Is there any documentation for this? Specifically the 'PerU' constant isn't documented in the photoshop scripting guide (or reference). I assume this is the one that triggers the Auto geometry.

Thanks

Known Participant
August 16, 2022

No, there is no documentation 🙂

Photoshop has an event notification subsystem - every action you take in the workspace generates a notification that contains the main parameters of the operation and can be performed again (initially, this subsystem was created to work with actions). We can receive these events in a variety of ways - either with scripts or with a ScriptListener plugin. This plugin receives notifications about events and generates code based on them, which allows us to execute them again (files with code are created on the desktop). In this case, i activated the ScriptListener plugin, opened camera raw, set the desired geometry correction parameter, and found the parameter in the generated code that is responsible for automatic geometry correction. Most parameters have readable and understandable names, but sometimes we have to act intuitively.


Thanks again for your input on this. I've installed the ScriptListener.8li pluging into the photoshop 2022 plug-ins folder on my windows 10 machine using the link you posted above. It is supposed to create a log file on the desktop, but it's not working. Any ideas why not. Is it compatible with the latest verson of photoshop?

Thanks again.