What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Loading all images in a folder into groups of 3 ...is it possible ?


Status
Not open for further replies.

davedps

New Member
Messages
2
Likes
0
Hi, Is it possible for either a script or an action to open a folder of images and load them into layers in groups of 3 ... so if the folder had 30 images it would end up with 1 files each with 3 layers ?

Thanks for any help

Dave
 
Here is an example script that will create PSD's of 3 jpgs each and save them in a folder called "Stacked" off the selected folder.
Code:
#target photoshop;
main();
function main(){
inputFolder = Folder.selectDialog("Please select the folder with Files to process");
if(inputFolder == null) return;
var newPath = Folder(decodeURI(inputFolder +"/Stacked"));
if(!newPath.exists) newPath.create();
var fileList = inputFolder.getFiles(/\.(jpg)$/i);
var files = new Array();
while(fileList.length >2){
for(var a =0;a<3;a++){files.push(fileList.shift());}
var Name = decodeURI(files[0].name).replace(/\.[^\.]+$/, '');
stackFiles(files);
var saveFile = File(newPath + "/" + Name + "-Stack.psd");
SavePSD(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
files=[];
    }
};
function stackFiles(files){
var loadLayersFromScript = true;
$.evalFile(app.path + "/" +  localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts") + "/Load Files into Stack.jsx");
loadLayers.intoStack(files);
};
function SavePSD(saveFile){ 
psdSaveOptions = new PhotoshopSaveOptions(); 
psdSaveOptions.embedColorProfile = true; 
psdSaveOptions.alphaChannels = true;  
activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE); 
};
 
Status
Not open for further replies.

Back
Top