7 Replies Latest reply on Jan 19, 2012 6:32 AM by gokdenizkaradag

    PS Scripting

    PhotogCda Level 1

      I'm looking for a good (i.e., able  to be understood by a non-programmer) resource on PS scripting.  I'm  not even sure what I want to do is possible.  I'd like to generate a  script that will do a batch Merge to HDR Pro.  I'd like to point the  script at a folder of images, have it take the first 'x' number in the  folder, merge them to an HDR file and save that HDR file to disk.  Then  it would go back, take the next 'x' number of images in seqence and  repeat.  The process would be repeated till the folder was complete.

       

       

      Thanks.

        • 1. Re: PS Scripting
          c.pfaffenbichler Level 9

          I can’t check if Merge to HDR Pro is Scriptable as I don’t have CS5 yet, but the rest of the operation seems fairly straightforward.

           

          »Adobe Intro To Scripting.pdf«, »Photoshop CS4 Scripting Guide.pdf« and the Sample Scripts (should all have been installed with Photoshop) offer a good starting point and one can always ask for advice here.

          • 2. Re: PS Scripting
            PhotogCda Level 1

            Thanks for the references.  I'm completely new to scripting.  Is there a way to check if Merge to HDR Pro is scriptable without writing a script to test it?  Also, is it possible to make the 'x' files a prompt for user input so that the number of images used can be changed according to the number of bracketed images?

            • 3. Re: PS Scripting
              c.pfaffenbichler Level 9
              Is there a way to check if Merge to HDR Pro is scriptable without writing a script to test it?

              Well, you can search the Documentation, I suppose the new version will be named »Photoshop CS5 JavaScript Ref.pdf«.

               

              Or you can temporarily put »ScriptingListener.plugin« into the Plug-ins-Folder »Automate«, restart Photoshop and do a Merge to HDR Pro.

              If that operation produces code it would be Scriptable. (Don’t forget to remove the plug-in after you’re done.)

               

              Or maybe one of the contributors to this Forum who has CS5 already could confirm one way or the other.

               

              Also, is it possible to make the 'x' files a prompt for user input so that the number of images used can be changed according to the number of bracketed images?

              Yes, one can create dialogs with JavaScript for entry of numbers, texts, Folder-selection, etc.

              • 4. Re: PS Scripting
                Michael L Hale Level 5

                Yes it is possible to run Merge to HDR Pro from a script. The script below shows how to do so with two files.

                 

                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 );
                
                mergeToHDR.useAlignment = true;
                mergeToHDR.outputBitDepth= 16;
                
                var filelist = [File('/p/mike/dcim/100ncd80/DSC_0212.NEF'),File('/p/mike/dcim/100ncd80/DSC_0215.NEF')];
                
                mergeToHDR.mergeFilesToHDR( filelist, true, -2 );
                

                 

                But it doesn't look like you can access the settings in the AdobeExposureMergeUI. And the results are different than running interactive. It's more like the old merge to HDR.

                • 5. Re: PS Scripting
                  PhotogCda Level 1

                  I ran the script listener plugin this morning and it generated code when I ran Merge to HDR Pro so I figured it was possible to invoke it from a script.  In terms of the exposure user interface, that's fine.  I'm not looking to tonemap from this script, just batch merge.  All I want to do at this point is create and save the 32 bit files.

                  • 6. Re: PS Scripting
                    Ian___

                    Hi Micheal, I know this is an older post, but I'm interested in doing batch HDR as well.  I was also curious how you could script Merge to HDR to load each bracketed sets of files one by one from a folder. The example script you posted points to specific files, instead of a folder.

                     

                    How would determine how many brackets to merge at a time, and how the files are grouped together? Would you have to make a script to load an explicit number of files at a time in alphabetical order, so I would have a script to merge 5 brackets, a script to merge 7 brackets, or could you group the brackets from exif data, or by the difference in file names? If it has to be by an explicit number, maybe you could script a gui in which the user specifics the number, instead of needing to have several scripts for one function.

                     

                    For example, I like to name my brackets with a suffix of _E01, _E02, etc. and the resulting hdr files with the same name. So if I had a folder with 2 sets of files named -

                     

                    Image_01_E01.jpg

                    Image_01_E02.jpg

                    Image_01_E03.jpg

                    Image_02_E01.jpg

                    Image_02_E02.jpg

                    Image_02_E03.jpg

                     

                    I would like to have a script that merges them into a seperate folder resulting in -

                     

                    Image_01.hdr

                    Image_02.hdr

                     

                    Is this possible to script at all?

                    • 7. Re: PS Scripting
                      gokdenizkaradag

                      Hi, i have written a batch HDR creation script that you can use.

                       

                      It takes hdr brackets organized in subfolders of a main container folder. The number of images and exposures are determined automatically.

                      It does not save all of the HDR file in a single folder but it is easy to modify the script.