Skip to main content
Participating Frequently
September 30, 2020
Question

Script for Camera Raw Presets

  • September 30, 2020
  • 1 reply
  • 3564 views

Hi could anyone help creating a script for photoshop and Camera Raw.

What I would like done is a script that would allow me to run a preset from Camera Raw into Photoshop.
Similar to the works of Stephen_A_Marsh's Camera Raw Auto Filter:

(function () {
  // Camera Raw Filter - Auto
    var desc1 = new ActionDescriptor();
    desc1.putBoolean(charIDToTypeID("AuTn"), true); // AuTn = Auto
    executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), desc1, DialogModes.NO);
})();

 

 

or:

 

autoCRF();

function autoCRF() {
  // Camera Raw Filter - Auto
    var desc1 = new ActionDescriptor();
    desc1.putBoolean(charIDToTypeID("AuTn"), true); // AuTn = Auto
    executeAction(stringIDToTypeID('Adobe Camera Raw Filter'), desc1, DialogModes.NO);
}

I would like a similar one that allows me to select a preset within Camera Raw and then if you could note how I could perhaps edit the code to replace one preset with another for different uses.

Shout out to all the coders that do this, because just looking at the code, as simple as some youtube videos make it out to be, I don't think I would be able to understand most of what is going on in javascript, or any code for that matter.

 

Coding isn't something I'm good at in anyway, so if it is too much to ask I can definitely understand. 

Thanks for taking the time to read and possibly assist with this.

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
September 30, 2020

I think you may be able to see how to do that if you read the code in Adobe Image Processor script. Where it lets you interactivity set the ACR setting you want on the first RAW file in the batch. Then the script uses your settings as a preset for the rest in the batch

JJMack
Participating Frequently
September 30, 2020

JJMack 

 

I've had a look at that and with that I've managed to use some of the code to automate Camera Raw's white balance, that changes the values depending on the image. The images I work on aren't in Raw format, I get them as Jpegs. So essentially what I'm looking for is a script that would select the preset I want to use and auto adjust the image as it would automatically if I went right into Camera Raw.

 

Example: 

 

Make a preset in Camera Raw that would use the auto feature in Basic to balance the image out.

Automatically straighten the image, Auto straightening.

and color correct the image.

 

With that preset made, I would like a script that would run the preset but also automatically change the values as per image.

Now I could make a preset that could do this and open Camera Raw, run the preset and it would do all this. But I want it to work as the Camera Raw Auto script mentioned in my original post.

But I have other things that need to be done to the image that I would like scripted as its a bit more complicated than running a preset via actions that has unchanged values.

I've setup the previous script mentioned in my beginning post within an action, so I press the hotkey and it does what its intended for, as well as other things in photoshop(brightness and contrast) but all it's doing is using the auto feature in the Basic panel of Camera Raw and nothing else. When I would like it to auto straighten and say for instance I've set that Texture remain on +20 but everything else changes automatically. Just selecting a specific preset sounds like it would be a lot easier to manage then and perhaps you make a new preset, just change the name of the preset that the script needs to run.

 

White Balance Script taken from Script Listener

 

var idAdobeCameraRawFilter = stringIDToTypeID( "Adobe Camera Raw Filter" );
var desc200 = new ActionDescriptor();
var idCMod = charIDToTypeID( "CMod" );
desc200.putString( idCMod, """Filter""" );
var idSett = charIDToTypeID( "Sett" );
var idSett = charIDToTypeID( "Sett" );
var idCst = charIDToTypeID( "Cst " );
desc200.putEnumerated( idSett, idSett, idCst );
var idWBal = charIDToTypeID( "WBal" );
var idWBal = charIDToTypeID( "WBal" );
var idAuto = charIDToTypeID( "Auto" );
desc200.putEnumerated( idWBal, idWBal, idAuto );
executeAction( idAdobeCameraRawFilter, desc200, DialogModes.NO );

 

Note: I'm not looking to batch process the images, I would like the script/s in an action pressed by a hotkey I assigned and just touched up if need be.

 

Thanks for your response.

 

Legend
September 30, 2020

I have never tried to automate camera raw (since even for a group of images taken under the same conditions, different corrections are usually required), however, in the output of the scriptListener, you can notice that when you select a preset, a line with the XML contents of the preset appears in the AdobeCameraRaw object and is placed in the object with desc settings .putString (idPset, '....'). However, if you remove all prior corrections from the scriptListener output and leave only the line with the preset, the file will open as if the preset had not been applied. I tried changing different variables but couldn't get it to apply it.
The only way that, as it seems to me, will be guaranteed to work, is to read and parse the preset XML file and put all the values ​​specified in it in the correction descriptor (most likely there is an easier way, but I don't know it).