Javascript Actionscript for batch edit and apply different ACR | XMP setting in Photoshop Camera RAW

Issue

I have static folder location for bulk edit my photo (~Desktop/New folder). I have some photos inside this folder and camera raw setting file (*.xmp). I have to edit my photo one by one with CameraRAW setting files, maybe like this:

Photo 1.jpg -> apply Setting 1.xmp;
Photo 2.jpg -> apply Setting 2.xmp;
Photo 3.jpg -> apply Setting 3.xmp;
Photo 4.jpg -> apply Setting 4.xmp;
Photo 5.jpg -> apply Setting 5.xmp;
...
...

All photos and settings in same folder. Can it be processed automatically like bulk image editing actions in Photoshop using javascript /jsx ?,

Thank you so much for your help.

Solution

I think it is possibly, but it looks like the Camera Raw Filter isn’t accessible via the usual activeDocument.activeLayer.applyCameraRaw(settings1, setting2...)

I thought you might be able to assign an explicit XMP, but it seems they are referred to by a unique ID taken from the XMP file 9 crs:UUID="A9A83D3876A04E49B36071604D357846")

The scriptListener code is really ugly. Take a look for yourself:

// =======================================================
var idAdobeCameraRawFilter = stringIDToTypeID( "Adobe Camera Raw Filter" );
  var desc8 = new ActionDescriptor();
  var idCMod = charIDToTypeID( "CMod" );
  desc8.putString( idCMod, """Filter""" );
  var idSett = charIDToTypeID( "Sett" );
  var idSett = charIDToTypeID( "Sett" );
  var idCst = charIDToTypeID( "Cst " );
  desc8.putEnumerated( idSett, idSett, idCst );
  var idWBal = charIDToTypeID( "WBal" );
  var idWBal = charIDToTypeID( "WBal" );
  var idAsSh = charIDToTypeID( "AsSh" );
  desc8.putEnumerated( idWBal, idWBal, idAsSh );
  var idTemp = charIDToTypeID( "Temp" );
  desc8.putInteger( idTemp, 0 );
  var idTint = charIDToTypeID( "Tint" );
  desc8.putInteger( idTint, 0 );
  var idCtoG = charIDToTypeID( "CtoG" );
  desc8.putBoolean( idCtoG, false );
  var idStrt = charIDToTypeID( "Strt" );
  desc8.putInteger( idStrt, 0 );
  var idShrp = charIDToTypeID( "Shrp" );
  desc8.putInteger( idShrp, 0 );
  var idLNR = charIDToTypeID( "LNR " );
  desc8.putInteger( idLNR, 0 );
  var idCNR = charIDToTypeID( "CNR " );
  desc8.putInteger( idCNR, 0 );
  var idVigA = charIDToTypeID( "VigA" );
  desc8.putInteger( idVigA, 0 );
  var idBlkB = charIDToTypeID( "BlkB" );
  desc8.putInteger( idBlkB, 0 );
  var idRHue = charIDToTypeID( "RHue" );
  desc8.putInteger( idRHue, 0 );
  var idRSat = charIDToTypeID( "RSat" );
  desc8.putInteger( idRSat, 0 );
  var idGHue = charIDToTypeID( "GHue" );
  desc8.putInteger( idGHue, 0 );
  var idGSat = charIDToTypeID( "GSat" );
  desc8.putInteger( idGSat, 0 );
  var idBHue = charIDToTypeID( "BHue" );
  desc8.putInteger( idBHue, 0 );
  var idBSat = charIDToTypeID( "BSat" );
  desc8.putInteger( idBSat, 0 );
  var idVibr = charIDToTypeID( "Vibr" );
  desc8.putInteger( idVibr, 0 );
  var idHA_R = charIDToTypeID( "HA_R" );
  desc8.putInteger( idHA_R, 0 );
  var idHA_O = charIDToTypeID( "HA_O" );
  desc8.putInteger( idHA_O, 0 );
  var idHA_Y = charIDToTypeID( "HA_Y" );
  desc8.putInteger( idHA_Y, 0 );
  var idHA_G = charIDToTypeID( "HA_G" );
  desc8.putInteger( idHA_G, 0 );
  var idHA_A = charIDToTypeID( "HA_A" );
  desc8.putInteger( idHA_A, 0 );
  var idHA_B = charIDToTypeID( "HA_B" );
  desc8.putInteger( idHA_B, 0 );
  var idHA_P = charIDToTypeID( "HA_P" );
  desc8.putInteger( idHA_P, 0 );
  var idHA_M = charIDToTypeID( "HA_M" );
  desc8.putInteger( idHA_M, 0 );
  var idSA_R = charIDToTypeID( "SA_R" );
  desc8.putInteger( idSA_R, 0 );
  var idSA_O = charIDToTypeID( "SA_O" );
  desc8.putInteger( idSA_O, 0 );
  var idSA_Y = charIDToTypeID( "SA_Y" );
  desc8.putInteger( idSA_Y, 0 );
  var idSA_G = charIDToTypeID( "SA_G" );
  desc8.putInteger( idSA_G, 0 );
  var idSA_A = charIDToTypeID( "SA_A" );
  desc8.putInteger( idSA_A, 0 );
  var idSA_B = charIDToTypeID( "SA_B" );
  desc8.putInteger( idSA_B, 0 );
  var idSA_P = charIDToTypeID( "SA_P" );
  desc8.putInteger( idSA_P, 0 );
  var idSA_M = charIDToTypeID( "SA_M" );
  desc8.putInteger( idSA_M, 0 );
  var idLA_R = charIDToTypeID( "LA_R" );
  desc8.putInteger( idLA_R, 0 );
  var idLA_O = charIDToTypeID( "LA_O" );
  desc8.putInteger( idLA_O, 0 );
  var idLA_Y = charIDToTypeID( "LA_Y" );
  desc8.putInteger( idLA_Y, 0 );
  var idLA_G = charIDToTypeID( "LA_G" );
  desc8.putInteger( idLA_G, 0 );
  var idLA_A = charIDToTypeID( "LA_A" );
  desc8.putInteger( idLA_A, 0 );
  var idLA_B = charIDToTypeID( "LA_B" );
  desc8.putInteger( idLA_B, 0 );
  var idLA_P = charIDToTypeID( "LA_P" );
  desc8.putInteger( idLA_P, 0 );
  var idLA_M = charIDToTypeID( "LA_M" );
  desc8.putInteger( idLA_M, 0 );
  var idSTSH = charIDToTypeID( "STSH" );
  desc8.putInteger( idSTSH, 0 );
  var idSTSS = charIDToTypeID( "STSS" );
  desc8.putInteger( idSTSS, 0 );
  var idSTHH = charIDToTypeID( "STHH" );
  desc8.putInteger( idSTHH, 0 );
  var idSTHS = charIDToTypeID( "STHS" );
  desc8.putInteger( idSTHS, 0 );
  var idSTB = charIDToTypeID( "STB " );
  desc8.putInteger( idSTB, 0 );
  var idPC_S = charIDToTypeID( "PC_S" );
  desc8.putInteger( idPC_S, 0 );
  var idPC_D = charIDToTypeID( "PC_D" );
  desc8.putInteger( idPC_D, 0 );
  var idPC_L = charIDToTypeID( "PC_L" );
  desc8.putInteger( idPC_L, 0 );
  var idPC_H = charIDToTypeID( "PC_H" );
  desc8.putInteger( idPC_H, 0 );
  var idPC_one = charIDToTypeID( "PC_1" );
  desc8.putInteger( idPC_one, 25 );
  var idPC_two = charIDToTypeID( "PC_2" );
  desc8.putInteger( idPC_two, 50 );
  var idPC_three = charIDToTypeID( "PC_3" );
  desc8.putInteger( idPC_three, 75 );
  var idShpR = charIDToTypeID( "ShpR" );
  desc8.putDouble( idShpR, 1.000000 );
  var idShpD = charIDToTypeID( "ShpD" );
  desc8.putInteger( idShpD, 25 );
  var idShpM = charIDToTypeID( "ShpM" );
  desc8.putInteger( idShpM, 0 );
  var idPCVA = charIDToTypeID( "PCVA" );
  desc8.putInteger( idPCVA, 0 );
  var idGRNA = charIDToTypeID( "GRNA" );
  desc8.putInteger( idGRNA, 0 );
  var idLPEn = charIDToTypeID( "LPEn" );
  desc8.putInteger( idLPEn, 0 );
  var idMDis = charIDToTypeID( "MDis" );
  desc8.putInteger( idMDis, 0 );
  var idPerV = charIDToTypeID( "PerV" );
  desc8.putInteger( idPerV, 0 );
  var idPerH = charIDToTypeID( "PerH" );
  desc8.putInteger( idPerH, 0 );
  var idPerR = charIDToTypeID( "PerR" );
  desc8.putDouble( idPerR, 0.000000 );
  var idPerS = charIDToTypeID( "PerS" );
  desc8.putInteger( idPerS, 100 );
  var idPerA = charIDToTypeID( "PerA" );
  desc8.putInteger( idPerA, 0 );
  var idPerU = charIDToTypeID( "PerU" );
  desc8.putInteger( idPerU, 0 );
  var idPerX = charIDToTypeID( "PerX" );
  desc8.putDouble( idPerX, 0.000000 );
  var idPerY = charIDToTypeID( "PerY" );
  desc8.putDouble( idPerY, 0.000000 );
  var idAuCA = charIDToTypeID( "AuCA" );
  desc8.putInteger( idAuCA, 0 );
  var idExonetwo = charIDToTypeID( "Ex12" );
  desc8.putDouble( idExonetwo, 0.000000 );
  var idCronetwo = charIDToTypeID( "Cr12" );
  desc8.putInteger( idCronetwo, 0 );
  var idHionetwo = charIDToTypeID( "Hi12" );
  desc8.putInteger( idHionetwo, 0 );
  var idShonetwo = charIDToTypeID( "Sh12" );
  desc8.putInteger( idShonetwo, 0 );
  var idWhonetwo = charIDToTypeID( "Wh12" );
  desc8.putInteger( idWhonetwo, 30 );
  var idBkonetwo = charIDToTypeID( "Bk12" );
  desc8.putInteger( idBkonetwo, -30 );
  var idClonetwo = charIDToTypeID( "Cl12" );
  desc8.putInteger( idClonetwo, 0 );
  var idDfPA = charIDToTypeID( "DfPA" );
  desc8.putInteger( idDfPA, 0 );
  var idDPHL = charIDToTypeID( "DPHL" );
  desc8.putInteger( idDPHL, 30 );
  var idDPHH = charIDToTypeID( "DPHH" );
  desc8.putInteger( idDPHH, 70 );
  var idDfGA = charIDToTypeID( "DfGA" );
  desc8.putInteger( idDfGA, 0 );
  var idDPGL = charIDToTypeID( "DPGL" );
  desc8.putInteger( idDPGL, 40 );
  var idDPGH = charIDToTypeID( "DPGH" );
  desc8.putInteger( idDPGH, 60 );
  var idDhze = charIDToTypeID( "Dhze" );
  desc8.putInteger( idDhze, 0 );
  var idTMMs = charIDToTypeID( "TMMs" );
  desc8.putInteger( idTMMs, 0 );
  var idCrv = charIDToTypeID( "Crv " );
      var list1 = new ActionList();
      list1.putInteger( 0 );
      list1.putInteger( 0 );
      list1.putInteger( 255 );
      list1.putInteger( 255 );
  desc8.putList( idCrv, list1 );
  var idCrvR = charIDToTypeID( "CrvR" );
      var list2 = new ActionList();
      list2.putInteger( 0 );
      list2.putInteger( 0 );
      list2.putInteger( 255 );
      list2.putInteger( 255 );
  desc8.putList( idCrvR, list2 );
  var idCrvG = charIDToTypeID( "CrvG" );
      var list3 = new ActionList();
      list3.putInteger( 0 );
      list3.putInteger( 0 );
      list3.putInteger( 255 );
      list3.putInteger( 255 );
  desc8.putList( idCrvG, list3 );
  var idCrvB = charIDToTypeID( "CrvB" );
      var list4 = new ActionList();
      list4.putInteger( 0 );
      list4.putInteger( 0 );
      list4.putInteger( 255 );
      list4.putInteger( 255 );
  desc8.putList( idCrvB, list4 );
  var idCamP = charIDToTypeID( "CamP" );
  desc8.putString( idCamP, """Embedded""" );
  var idCP_D = charIDToTypeID( "CP_D" );
  desc8.putString( idCP_D, """54650A341B5B5CCAE8442D0B43A92BCE""" );
  var idPrVe = charIDToTypeID( "PrVe" );
  desc8.putInteger( idPrVe, 167772160 );
  var idRtch = charIDToTypeID( "Rtch" );
  desc8.putString( idRtch, """""" );
  var idREye = charIDToTypeID( "REye" );
  desc8.putString( idREye, """""" );
  var idLCs = charIDToTypeID( "LCs " );
  desc8.putString( idLCs, """""" );
  var idUpri = charIDToTypeID( "Upri" );
  desc8.putString( idUpri, """<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21        ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
  xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/"
 crs:UprightVersion="151388160"
 crs:UprightCenterMode="0"
 crs:UprightCenterNormX="0.5"
 crs:UprightCenterNormY="0.5"
 crs:UprightFocalMode="0"
 crs:UprightFocalLength35mm="35"
 crs:UprightPreview="False"
 crs:UprightTransformCount="6"/>
</rdf:RDF>
</x:xmpmeta>
""" );
  var idGuUr = charIDToTypeID( "GuUr" );
  desc8.putString( idGuUr, """""" );
  var idLook = charIDToTypeID( "Look" );
  desc8.putString( idLook, """<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21        ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
  xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/">
 <crs:Look>
  <rdf:Description
   crs:Name="B&amp;W 03"
   crs:Amount="1.000000"
   crs:Cluster="Adobe"
   crs:UUID="ADB81986EAF84E0999C0112BDE1F93D1"
   crs:SupportsMonochrome="false"
   crs:Copyright="© 2018 Adobe Systems, Inc."
   crs:Stubbed="true">
  <crs:SortName>
   <rdf:Alt>
    <rdf:li xml:lang="x-default">B&amp;W 03</rdf:li>
   </rdf:Alt>
  </crs:SortName>
  <crs:Group>
   <rdf:Alt>
    <rdf:li xml:lang="x-default">B&amp;W</rdf:li>
   </rdf:Alt>
  </crs:Group>
  </rdf:Description>
 </crs:Look>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
""" );
  var idPset = charIDToTypeID( "Pset" );
  desc8.putString( idPset, """<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c140 79.160451, 2017/05/06-01:08:21        ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
  xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/">
 <crs:Preset>
  <rdf:Description
   crs:Name="B&amp;W High Contrast"
   crs:Amount="1.000000"
   crs:Cluster="Adobe 1.3"
   crs:UUID="A9A83D3876A04E49B36071604D357846"
   crs:SupportsMonochrome="false"
   crs:LookAmount="1.000000">
  <crs:Group>
   <rdf:Alt>
    <rdf:li xml:lang="x-default">B&amp;W</rdf:li>
   </rdf:Alt>
  </crs:Group>
  <crs:Parameters>
   <rdf:Description
    crs:Version="10.5"
    crs:ProcessVersion="10.0"
    crs:SplitToningShadowHue="0"
    crs:SplitToningShadowSaturation="0"
    crs:SplitToningHighlightHue="0"
    crs:SplitToningHighlightSaturation="0"
    crs:SplitToningBalance="0"
    crs:Whites2012="+30"
    crs:Blacks2012="-30"
    crs:Clarity2012="0"
    crs:Dehaze="0"
    crs:ToneCurveName2012="Linear">
   <crs:ToneCurvePV2012>
    <rdf:Seq>
     <rdf:li>0, 0</rdf:li>
     <rdf:li>255, 255</rdf:li>
    </rdf:Seq>
   </crs:ToneCurvePV2012>
   <crs:ToneCurvePV2012Red>
    <rdf:Seq>
     <rdf:li>0, 0</rdf:li>
     <rdf:li>255, 255</rdf:li>
    </rdf:Seq>
   </crs:ToneCurvePV2012Red>
   <crs:ToneCurvePV2012Green>
    <rdf:Seq>
     <rdf:li>0, 0</rdf:li>
     <rdf:li>255, 255</rdf:li>
    </rdf:Seq>
   </crs:ToneCurvePV2012Green>
   <crs:ToneCurvePV2012Blue>
    <rdf:Seq>
     <rdf:li>0, 0</rdf:li>
     <rdf:li>255, 255</rdf:li>
    </rdf:Seq>
   </crs:ToneCurvePV2012Blue>
   </rdf:Description>
  </crs:Parameters>
  </rdf:Description>
 </crs:Preset>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
""" );
executeAction( idAdobeCameraRawFilter, desc8, DialogModes.NO );

I think, in this case recording an Action for each setting may be your best bet.

Answered By – Ghoul Fool

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published