0 Replies Latest reply on Apr 17, 2012 10:07 AM by Johannalc40

    Script for Batch HDR with Surrelistic Presets

    Johannalc40

      I have the following script to Batch HDR. I am looking to add the Surrelistic Presets to all of my HDR. What is the script that I need to add to this? I am working in CS5

       

      // Batch Creation of HDR files

      // -----------------------------------------------------------------------------------

      // Opens a dialog box, asking for the container folder.

      // The container folder must have separate sub folders for each of the HDR image series

      // The output can be saved in a subfolder with an arbitrary name by

      // changing the options below.

      //

      // example: to save hdr files as

      // C:\container\hdrseries1\myhdrfolder\myhdr.psd

      // change the options HDROutputFolder to "myhdrfolder"

      // and option HDRFileName to "myhdr"

      //

       

       

      // Extensions of source image files

      var pictureExtensions = "*.jpg";

      // Sub-folder to save the resulting HDR file. This folder will be created if it does not exist.

      //var HDROutputFolder = "";  // disable subfolder like this

      var HDROutputFolder = "";

      // Filename for saved HDR file. Do not set the extension here, extension is set automatically according to saveResultAsEXR option.

      var HDRFileName = "HDR";

      // Save EXR file (requires EXR plugin) If set to "false" saves the HDR as a  .PSD file

      var saveResultAsEXR = false;

      // Overwrite existing HDR output files? If set to "false" skips creating HDR files for already created image sets.

      // This is useful for adding some new HDR sets into the container folder, and running the script again

      // to crate HDR files only for the newly added series.

      var overwriteExistingHDR = false;

      // --------------- End of settings ------------------- //

       

       

      var runMergeToHDRFromScript = true;// define and set to true before including Merge To HDR.jsx

      var g_ScriptFolderPath = app.path + "/"+ localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts");

      var g_ScriptPath = File( g_ScriptFolderPath+'/Merge To HDR.jsx' );

      $.evalFile( g_ScriptPath );

       

       

      // function to manually save an EXR file. Requires EXR plugn to be installed

      function saveEXR(saveFile){

          var idsave = charIDToTypeID( "save" );

          var desc6 = new ActionDescriptor();

          var idAs = charIDToTypeID( "As  " );

          desc6.putString( idAs, "OpenEXR" );

          var idIn = charIDToTypeID( "In  " );

          desc6.putPath( idIn, saveFile );

          executeAction( idsave, desc6, DialogModes.NO );

      }

       

       

      function main()

      {

          var bracket_folders = [];

          var selected_folder = Folder.selectDialog ("/Users/johannalc40/Documents/HDR")

          if (selected_folder != null)

          {                                   

              // to process multiple container folders, uncomment following line and edit folder paths.

              //bracket_folders = [ Folder('/c/images/bracket5'), Folder('/c/images/bracket9')];  

              bracket_folders = bracket_folders.concat(selected_folder);

              for (var f = 0; f < bracket_folders.length; f++)

              {

                  var image_folders = bracket_folders[f].getFiles();

       

       

                  for (var g = 0; g < image_folders.length; g++)

                  {

                      var folder = image_folders[g];

                      if( ! (image_folders[g] instanceof Folder) ) continue;// only process folders

                      var filelist = image_folders[g].getFiles(pictureExtensions);

                      var photoshopHDRFolder = Folder(folder.absoluteURI + "/" + HDROutputFolder);

                      if (saveResultAsEXR) {

                          var extension = ".exr";

                      } else {

                          var extension = ".psd";

                      }

                      var photoshopHDRFile = File(photoshopHDRFolder.absoluteURI + "/" + HDRFileName + extension);

                     

                      if (overwriteExistingHDR ==false && photoshopHDRFile.exists == true) {

                          continue;

                      }

       

       

                      mergeToHDR.useAlignment = true;

                      mergeToHDR.outputBitDepth= 32;

       

       

       

                      mergeToHDR.mergeFilesToHDR( filelist, true, -2 );

                                                          

                      if (photoshopHDRFolder.exists == false) {

                          photoshopHDRFolder.create();

                      }

       

       

                      if (saveResultAsEXR) {

                          saveEXR(photoshopHDRFile);

                      } else {

                          activeDocument.saveAs(photoshopHDRFile );  // Use for PSD files

                      }

                      activeDocument.close(SaveOptions.DONOTSAVECHANGES);

                  }

              }

          }

      }