Copy link to clipboard
Copied
is a simple way to batch process two folders of images so that say... Folder 1 Image 1 is overlaid on Folder 2 Image 1 to create a composite? I have a series of images I want to overlay on to each other but I am not sure if it's possible other than by opening each by hand which would take ages.
Copy link to clipboard
Copied
You may want to ask over on the Scripting Forum, the task has come up repeatedly and can usually be automated but your description seems insufficient so far:
Copy link to clipboard
Copied
How do you want to composite them: two separate image in one image, or overlapping with some sort of blend mode or masking?
Copy link to clipboard
Copied
I want to overlay one image on top of the other and blend with multiply or similar.
Copy link to clipboard
Copied
You can do that pretty easily with scripting. Just a matter of defining the two folder, and making sure they are in the order you want. You can then use scriptlistener to get the code for placing a file into another. Then you put all the files from the folder in a new array with the getFiles() statement. then you create a loop to go through that array and open one of the files from one folder, then place a file from the other folder. You can then change the blend mode of the layer to whatever you want, and save and close, or what ever you want to do with the file.
Copy link to clipboard
Copied
Thank you. I have never done any scripting before, is there somewhere I can get more detailed information on the process and this particular script? Thank you so much.
Copy link to clipboard
Copied
The other question would be: Do you want to stop at each image to do something, or just combining the photos, saving them, then going back later and do some editing? Stopping to do something is more complicated.
Copy link to clipboard
Copied
I don't think I need to stop at each images as I only want to blend the two images together. So Image 1 from Folder 1 is blended as layer on to Image 1 folder 2. I hope that makes sense.
Copy link to clipboard
Copied
Ok, the below script will combine files from two different folders then save the result to a third folder. You need to edit the script to point to folders that you have on your HD (lines 2-4). Thre is no error checking, so if you don't have the same number of files in each folder, it will stop and give you an error. If you have any other type of file other than an image file in the folder it will stop and give an error - this included XMP files, so if you're using raw files, change them to dngs first. Right now the script is set to set the top layer to overlay mode. You can change that in line 14.
#target photoshop
var folder1 = new Folder('/c/folder1/');
var folder2 = new Folder('/c/folder2/');
var saveFolder = new Folder('/c/folder3/');
var searchMask = '*.???';
var list1= folder1.getFiles(searchMask);
var list2= folder2.getFiles(searchMask);
var psdOptions = new PhotoshopSaveOptions();
psdOptions.layers = true;
for(var i=0;i<list1.length;i++){
var doc = open(list1);
var docName = doc.name;
placeFile (list2, 100);
doc.activeLayer.blendMode = BlendMode.OVERLAY;//change overlay mode
doc.saveAs (new File(saveFolder +'/' + docName.split('.')[0] + '.psd'), psdOptions);
doc.close(SaveOptions.DONOTSAVECHANGES);
};
function placeFile(file,scale){
try{
var idPlc = charIDToTypeID( "Plc " );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
desc2.putPath( idnull, new File( file ) );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc2.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc3 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc3.putUnitDouble( idHrzn, idPxl, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc3.putUnitDouble( idVrtc, idPxl, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc2.putObject( idOfst, idOfst, desc3 );
var idWdth = charIDToTypeID( "Wdth" );
var idPrc = charIDToTypeID( "#Prc" );
desc2.putUnitDouble( idWdth, idPrc, scale );
var idHght = charIDToTypeID( "Hght" );
var idPrc = charIDToTypeID( "#Prc" );
desc2.putUnitDouble( idHght, idPrc, scale );
var idAntA = charIDToTypeID( "AntA" );
desc2.putBoolean( idAntA, true );
executeAction( idPlc, desc2, DialogModes.NO );
}
catch(e){}
}//end function placeFile
Copy link to clipboard
Copied
Thanks for putting this together. I've tried putting the above text into a .jsx file and running it as a script in PS CC 2018. I just keep getting errors. Am I running this the right way?

Copy link to clipboard
Copied
Remove the line numbering ![]()
Copy link to clipboard
Copied
Thanks! That got it to run. Sadly its not putting the layer from folder two and setting it to overlay.
Copy link to clipboard
Copied
Follow chuck's instructions or specify your conditions
- wrong folder? try something like: '~/Desktop/Layers Test/Folder One'
- folders exist?
- same number of files?
- only image-files available in your folders?
- tested other blending mode (line 14) like MULTIPLY?
Copy link to clipboard
Copied
Guys, I just found your post and this is what I would like to do also. Can you help me please a little bit? I'm on mac, I created the .jsx file an it gives me errors.
Error 8: Syntax error.
Line: 1
-> {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf200
Copy link to clipboard
Copied
I'm not sure what you're doing. Are you using the above code? If so, don't use the line numbering, not sure what that first brace is for at the beginning of the line. If you're trying to replace a folder path into a variable, follow the examples above.
Copy link to clipboard
Copied
Looks like the text file is a rich text file, not plain text.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now