Skip to main content
metallicamatt
New Participant
July 19, 2015
Answered

Load multiple selected stacks as individual layered files for each stack

  • July 19, 2015
  • 1 reply
  • 1215 views

Hi -

Does anyone know if there is a way to load multiple stacks of images at a time, with each stack loading into PS CC as individual layered image sets? I've searched this site and others to no avail.

My intention is to save the time of opening 150+ images and then stacking them manually to do HDR work on each set. I've tried loading the stacks using Load Files to Photoshop Layers, but this stacks all the stacks into one image with all the stacks in layers beneath. With a properly running script I'd like to be able to open, say 3 images - each with 3 exposures. And then have photoshop create 3 images, each with their 3 exposures. I could then commence with the HDR work by hand for each set.

Any insight is appreciated!

Thanks,
Matt

This topic has been closed for replies.
Correct answer I have gone

Very nice! Thank you, Phillip. This is going to save me a LOAD of time!!

I have one additional question. I saw in the link you attached above, cutch2222 (comment 34) asked about renaming the image stack in PS the same name of the first image (or any image name within that stack) so they save adjacent each other. I've looked through your amended code (comment 35), trying to parse what I needed and didn't see this individual funtion.

What could I add in there to rename the layered Untitled copy.jpg, to that of one in that stack? I don't need it to save for me, since I'll do that once I finish the edit.

Thank you for your willingness to help.

Sincerely,

Matt


Sorry I was away. The documents that are created will always have the Untitled in the file name as they are created with the "Load Files into Stack.jsx" and this cannot be changed without saving the document.

If I misunderstood please let me know.

1 reply

Inspiring
July 19, 2015
metallicamatt
New Participant
July 19, 2015

I have tried to load the following (taken from that post) as a .jsx file and Bridge CC says "An error occurred running startup script... It may not be compatible with this version of Bridge..."

  1. // this is a Bridge script, run from ESTK with Bridge as the target app 
  2. var stacks = app.document.stacks; 
  3. var stackCount = stacks.length; 
  4. for(var s = 0;s<stackCount;s++){ 
  5.      var stackFiles = getStackFiles( stacks ); 
  6.      if(stackFiles.length> 1){ 
  7.           var bt = new BridgeTalk; 
  8.           bt.target = "photoshop"; 
  9.           var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");"); 
  10.           bt.body = myScript;  
  11.           bt.onResult = function( inBT ) {myReturnValue(inBT.body); } 
  12.           bt.send(500); 
  13.      } 
  14. function getStackFiles( stack ){ 
  15.      var files = new Array(); 
  16.      for( var f = 0; f<stack.thumbnails.length;f++){ 
  17.           files.push(stack.thumbnails.spec); 
  18.      } 
  19.      return files; 
  20. }; 
  21. function myReturnValue(str){ 
  22.      res = str; 
  23. // don't have comments in the psRemote function 
  24. function psRemote(stackFiles){ 
  25.      var loadLayersFromScript = true; 
  26.      var strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets"); 
  27.      var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts"); 
  28.      var strFile2Stack = "Load Files into Stack.jsx"; 
  29.      var ipFilePath = app.path + "/" + strPresets + "/" + strScripts + "/" + strFile2Stack; 
  30.      var ipFile = new File (ipFilePath); 
  31.      $.evalFile( ipFile ); 
  32.      loadLayers.intoStack(stackFiles); 
  33.      app.doAction ('Action 2', 'test'); 
  34.      var saveFile = new File('~/desktop/'+app.activeDocument.name+'.psd'); 
  35.      app.activeDocument.saveAs(saveFile); 
  36.      app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
Inspiring
July 20, 2015

That will fail, the code is for testing in the Adobe Integrated Development Environment called ExtendScript Toolkit (ESTK) as such will not run as a jsx file without further modification.

This will run as a jsx file and can be run from the Tools menu.



  1. #target bridge    
  2. if( BridgeTalk.appName == "bridge" ) {   
  3. stacksToLayers = new MenuElement("command", "Stacks To Layers",  "at the end of Tools"); 
  4. stacksToLayers.onSelect = function () { 
  5. var stacks = app.document.stacks; 
  6. var stackCount = stacks.length; 
  7. for(var s = 0;s<stackCount;s++){ 
  8.       var stackFiles = getStackFiles( stacks ); 
  9.       if(stackFiles.length> 1){ 
  10.            var bt = new BridgeTalk; 
  11.            bt.target = "photoshop"; 
  12.            var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+stackFiles.toSource()+");"); 
  13.            bt.body = myScript; 
  14.            bt.onResult = function( inBT ) {myReturnValue(inBT.body); } 
  15.            bt.send(500); 
  16.       } 
  17. function getStackFiles( stack ){ 
  18.       var files = new Array(); 
  19.       for( var f = 0; f<stack.thumbnails.length;f++){ 
  20.            files.push(stack.thumbnails.spec); 
  21.       } 
  22.       return files; 
  23. }; 
  24. function myReturnValue(str){ 
  25.       res = str; 
  26. function psRemote(stackFiles){ 
  27.       var loadLayersFromScript = true; 
  28.       var strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets"); 
  29.       var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts"); 
  30.       var strFile2Stack = "Load Files into Stack.jsx"; 
  31.       var ipFilePath = app.path + "/" + strPresets + "/" + strScripts + "/" + strFile2Stack; 
  32.       var ipFile = new File (ipFilePath); 
  33.       $.evalFile( ipFile ); 
  34.       loadLayers.intoStack(stackFiles); 
  35. };