Copy link to clipboard
Copied
Hi.
I'm looking for a method to batch combine two photos with for example the same filename to layers in one tif file.
Example:
DSC0001.tif = Layer 1
DSC0001.jpg = Layer 2
I do process photos twice in different ways and now I manually open photo by photo, import different version and do 50% opacity :(
Please help 🙂
Sorry for my bad English.
I made a quick edit to a script that I had previously hacked together. A single source folder is selected and the script will then process pairs of files, stacking one over the other at 50% opacity, then save out a JPEG into a newly named folder within the source folder.
It is assumed that all file pairs have correct alphabetical pair names for sorting and that the total count of all files is divisible by 2.
#target photoshop
var restoreDialogMode = app.displayDialogs;
app.displayDialogs
...
Copy link to clipboard
Copied
The "BatchMockupTemplates.jsx" in my Free Photoshop Photo Collage and Mockup Toolkit will do that but save the combines images as a jpeg and optionally as a Layered PSD. There is no option to save layered Tiff files. All you need do is create a mockup template for how you want to combine the two images, and have the images in two folder and point the script to the templates, images collection and output destination.
Copy link to clipboard
Copied
To create the mockup template all you need to do is open a net document that has a canvas size and print resolution as your two image files. Place in one Tif image to cover the canvas. then place in one jpeg to covet the first image. Set the layers opacity to 50%. and save the document as your Mockup PSD template.
Put the mock in a job folder sub folder Mockup. Create a Replacement Image collection folder in the job folder and in the collection folder in a sub folder obj0 and sub folder obj1. Store you jpeg files in folder objo and store your tiff files in obj1. The run the script do not forget to check save psd file
You could add additional mockup templates into the mockup folder where you would mask half the top Smart object layer to let the bottom object show in the mask off half. An additional one where the canvas is twice as wide and you place the images in side by side the script would populate all three templates in a single run
Copy link to clipboard
Copied
JJMack's scripts are a good place to start.
I adapted one of his scripts for this task in another forum topic:
https://community.adobe.com/t5/photoshop/batch-automating-sequences-of-images/m-p/10619866
https://github.com/MarshySwamp/Layer-Stack-N-Number-of-Files-Filename-as-Top-Layer
Copy link to clipboard
Copied
I made a quick edit to a script that I had previously hacked together. A single source folder is selected and the script will then process pairs of files, stacking one over the other at 50% opacity, then save out a JPEG into a newly named folder within the source folder.
It is assumed that all file pairs have correct alphabetical pair names for sorting and that the total count of all files is divisible by 2.
#target photoshop
var restoreDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
main();
function main() {
inputFolder = Folder.selectDialog("Please select the folder with Files to process");
if (inputFolder === null) return;
var newPath = Folder(decodeURI(inputFolder + "/Combined")); // Create sub-dir
if (!newPath.exists) newPath.create();
var fileList = inputFolder.getFiles(/\.(jpg|jpeg|tif|tiff|png|psd)$/i); // Limit file format input
fileList.sort(); // Force alpha-numeric list sort
while (fileList.length) {
for (var a = 0; a < 2; a++) { // Digit 2 for two files
try {
app.open(fileList.pop());
} catch (e) { }
}
processFiles();
}
alert("Done!");
function processFiles() {
try {
var Name = app.documents[0].name.replace(/\.[^\.]+$/, ''); // Remove file extension
app.activeDocument = documents[1];
app.activeDocument.activeLayer.duplicate(documents[0]);
app.activeDocument = documents[0];
var doc = app.activeDocument;
doc.activeLayer.opacity = 50.0; // Layer opacity
doc.activeLayer.blendMode = BlendMode.NORMAL; // Blend mode
app.displayDialogs = restoreDialogMode;
} catch (e) { }
var saveFile = File(newPath + "/" + Name + "_Combined" + ".tif");
saveTIFF(saveFile);
while (app.documents.length) {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
}
}
function saveTIFF(saveFile) {
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.byteOrder = ByteOrder.IBM;
tiffSaveOptions.transparency = true;
tiffSaveOptions.layers = true;
tiffSaveOptions.layerCompression = LayerCompression.ZIP;
tiffSaveOptions.interleaveChannels = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.annotations = true;
tiffSaveOptions.spotColors = true;
tiffSaveOptions.saveImagePyramid = false;
// NONE | JPEG | TIFFLZW | TIFFZIP
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
app.activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
}
The script can be modified to save out a TIFF if it otherwise performs as required... What TIFF save options are needed?
EDIT: I have updated the code with TIFF save options rather than JPEG.
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
The script saved flat Jpeg so they could be used on the web. There a Save PSD option that can save layer files if you want to be able to tweak or edit the populated template. With your modification they need to tun a second batch job to save the Tiff Files as jpeg. You should have changed the save PSD option to Save Tiff option.
Copy link to clipboard
Copied
Sir, is there an update for this script on Photoshop 24.4.1 Release? I have been trying to get this to work without success. Any help is appreciated. I am trying to add a second layer of the same image number and save to assist with some edits.
Copy link to clipboard
Copied
Please provide specific info on the problem, it may have nothing to do with the version of Photoshop.
Please provide 2 example filename pairs/sets (4 images) that you are trying to stack/combine.
Copy link to clipboard
Copied
@Stephen_A_Marshhere are the steps and location of the images to stack. I'd like to bring the .jpg image into the .psd file (or .tif). I am getting this error. I have the script saved as addlayer.js not .rtf. I had to include rtf b/c Adobe does not allow this script to be attached. Any help for what I am doing wrong is appreciated. Thank you
Copy link to clipboard
Copied
@webesco – Image 003.png indicates that the script was saved as an RTF and not TXT file before being renamed as .JS
Mac: Apple TextEdit (ensure that the Format menu is set to Plain Text mode, not Rich Text mode)
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
That worked! Thank you for the assistance.
Copy link to clipboard
Copied
Works great 😄
Thank you all for your help 🙂
Copy link to clipboard
Copied
Thanks for the feedback, please mark the answer/answers that helped you as correct so that others with the same issue know that there is a solution.
Copy link to clipboard
Copied
Great job!!!!!!!!!!!!!!
Copy link to clipboard
Copied
Thank you for coming back and marking a correct answer.
Copy link to clipboard
Copied
Thank you for your time and your help 🙂