Highlighted

Script for Camera Raw Presets

New Here ,
Sep 30, 2020

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting, How to, Windows

Views

117

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script for Camera Raw Presets

New Here ,
Sep 30, 2020

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting, How to, Windows

Views

118

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 30, 2020 0
Most Valuable Participant ,
Sep 30, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0
New Here ,
Sep 30, 2020

Copy link to clipboard

Copied

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.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0
Enthusiast ,
Sep 30, 2020

Copy link to clipboard

Copied

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).

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0
New Here ,
Sep 30, 2020

Copy link to clipboard

Copied

jazz-y 

 

I don't quite understand what all that means, and just from my understanding it seems like it's a complicated task to accomplish. I've looked at the code in the ScriptingListenerJS file as well where the preset is, and within Extendscript tool kit tried multiple ways to get it to work, using of the Camera Raw Auto code and couldn't quite get anything to work, what I think is the values that need to change randomly based off whatever image the preset needs to apply could be too much to task. 

What I'm thinking as an alternative is perhaps an auto straightening script that I could attach to an action instead. Doesn't matter too much if its in different layers just so long it works.

I've got the Camera Raw Auto script already and that works great. If its possible to add to that code just so that the auto straightening and white balance works as well, perhaps in the same camera raw instance that would be great but if not it can be in 3 instances? Instead of using a preset to do it?

I've tried it myself but to no avail. I managed to get Camera Auto and the white balance to work in 2 instances but I can't seem to understand where the Auto/Vertical/Horizontal straightening code is. I found the values that it straightened to the specific image I was working on but thats specific to that image and doesn't work on a different image.

Everything else I use I've made into a normal action which is set on a smart object incase i need to tweek it a bit, its just that within camera raw that I havent managed to create or find online.

Thanks for your time.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0
JJMack LATEST
Most Valuable Participant ,
Sep 30, 2020

Copy link to clipboard

Copied

I believe the script will need to use Action Manager code to pass the ACR parameters description to ACR.  The problem I have is I do not know how to code Action manager code or know javascript I just hack at it.  Looking at Adobe's Image Processor script.  It looks like its uses Action Manager code to run ACR. The first time it can be Interactive where ACR will open its dialog and the user cans set all the parameters for ACR interactivity. ]When ACR is done doing its job. The image processor script  retrieves the action  manager ACR parameters description the user set set.  After the first interactive use of  ACR the image processor when it runs ACR it will bypass using ACR interactive UI and pass the ACR parameter description it retrieved the first time.  I think you would need to study the ACR action manager ACR parameters description  object/message whatever it is. So yo can pass the ACR settings you want to use.  You may be able to coder a script that would interactivity use ACR then retrieve the description  you use set. The script would display all the settings it retrieved. See if setting for straighting can be passed. 

 

As I wrote I not an expert when it come to scripting Photoshop particularu when it comes to Action Manager code.  I extracted the part in Adobe Image Processot the seem to do the ACR work.

 

To me it looks like the Action Manager  ACR execution returns the description and the script extracts info from it. 

 

var returnDesc = executeAction( charIDToTypeID( 'Opn ' ), desc, inDialogMode );

 

if ( ! gOpenedFirstCR && this.params["open"] && IsFileOneOfThese( cameraRawParams.fileName, gFilesForCameraRaw ) ){
	// this is the first CR file and the user elected to open it and choose settings to apply to the
	// rest of the CR files
	gOpenedFirstCR = true;
	cameraRawParams.useDescriptor = true;
	this.OpenCameraRaw( cameraRawParams, true )
} else {
	this.OpenCameraRaw( cameraRawParams, false, DialogModes.NO );
}
							
							
							
// open a camera raw file returning the camera raw action desc
this.OpenCameraRaw = function( inOutCameraRawParams, updateCRDesc, inDialogMode ) {
	var keyNull = charIDToTypeID( 'null' );
	var keyAs = charIDToTypeID( 'As  ' );
	var adobeCameraRawID = stringIDToTypeID( "Adobe Camera Raw" );
	var desc = new ActionDescriptor();
	desc.putPath( keyNull, File( inOutCameraRawParams.fileName ) );
	if ( inOutCameraRawParams.desc != undefined && inOutCameraRawParams.useDescriptor &&
	     IsFileOneOfThese( inOutCameraRawParams.fileName, gFilesForCameraRaw ) ) {
		desc.putObject( keyAs, adobeCameraRawID, inOutCameraRawParams.desc );
	}
	if ( inDialogMode == undefined ) {
		inDialogMode = DialogModes.ALL;
		
		// Suppress choose file dialog.
		var overrideOpenID = stringIDToTypeID( 'overrideOpen' );
		desc.putBoolean( overrideOpenID, true );
	}
	var returnDesc = executeAction( charIDToTypeID( 'Opn ' ), desc, inDialogMode );
	if ( returnDesc.hasKey( keyAs ) ) {
		if (updateCRDesc)
			inOutCameraRawParams.desc = returnDesc.getObjectValue( keyAs, adobeCameraRawID );
		if ( returnDesc.hasKey( keyNull ) ) {
			inOutCameraRawParams.fileName = returnDesc.getPath( keyNull ).toString();
			return true;
		}
	}
	return false;
}

 

 

 

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0