Skip to main content
Participant
July 14, 2010
Beantwortet

Automate merge files into stack

  • July 14, 2010
  • 2 Antworten
  • 8635 Ansichten

Hi all,

I need to find a way to do the following:

Merge 4 currently open images into a single stack into separate layers.

Screen all layers

Extract the top three layers into a new file

Flatten both images and save as .tif

Any ideas?

Even scripting the 1st two steps would be great.I've tried "Merge files into stack", but it won't let me automate the "add open files" part of that.

Thanks.

Dieses Thema wurde für Antworten geschlossen.
Beste Antwort von Michael_L_Hale

You can automate loading open docs into a stack using the Load Files into Stack.jsx as long as the documents have a file( either opened from a file or have been saved at least once)

var loadLayersFromScript = true;
//@includepath "/c/program files/adobe/Adobe Photoshop CS5/Presets/Scripts/"
//@include "load files into stack.jsx"
var files = [];
for(var d =0;d<app.documents.length;d++){
    try{
        files.push(app.documents.fullName.fsName);
    }catch(e){
        alert(localize('$$$/AdobePlugin/Exposuremerge/Mustsave=Documents must be saved before they can be merged'));
    }
}
loadLayers.intoStack(files,true);

2 Antworten

Inspiring
July 15, 2010

You can automate loading open docs into a stack using the Load Files into Stack.jsx as long as the documents have a file( either opened from a file or have been saved at least once)

var loadLayersFromScript = true;
//@includepath "/c/program files/adobe/Adobe Photoshop CS5/Presets/Scripts/"
//@include "load files into stack.jsx"
var files = [];
for(var d =0;d<app.documents.length;d++){
    try{
        files.push(app.documents.fullName.fsName);
    }catch(e){
        alert(localize('$$$/AdobePlugin/Exposuremerge/Mustsave=Documents must be saved before they can be merged'));
    }
}
loadLayers.intoStack(files,true);

Participating Frequently
February 2, 2011

Big newb here.... but was hoping to get some advice on how

to use the script you wrote down here in cs3 extended? I'm trying to use the event script manager to automatically merge all open files without having to click the button in the Load Files into Stack.jsx dialog. Do I save that script you wrote down as a separate java script and load it into the event script manager? ..i tried that and it gives me an error message that says

Error 24: this.mergeStackElements is not a function.

Line: 124

->       this.mergeStackElements();

this is in reference to the loadfilesinto stack.jsx file i'm guessing? any suggestions would be greatly appreciated. thank u!

Inspiring
February 3, 2011

yea...i had updated the include path for CS3...its 32-bit photoshop though...not sure if that may be a problem. thanks


It does look like there is an error in the CS3 version of Load Files into Stacks. The function mergeStackElements() is called but never defined. Both the CS4 and CS5 call this.stackLayers(); instead of this.mergeStackElements();

If you are willing to edit the Adobe script to make that change it will work in CS3.

JJMack
Community Expert
Community Expert
July 15, 2010

I can not tell you how to do it but you could look at the Image processor script the comes with Photoshop fot it has an option to process open documents. Therefore it has code to process all open documents. You may find what your looking for in therr for it also creates new documents.

JJMack