Copy link to clipboard
Copied
Hello,
I'm looking for a way to create a batch or script that can vertically combine multiple images from within a single folder. Ideally, the vertically stacked images would be directly connected without any space in between, and they would remain as separate layers rather than merging.
Since all the images within the folder are of the same size, there would be no need for a feature to adjust the size.
While I've come across posts discussing how to combine images horizontally via batch, I haven't been able to find any information on doing the same vertically. Hence, I'm reaching out here for assistance.
Thank you in advance!
1 Correct answer
Try these links:
Explore related tutorials & articles
Copy link to clipboard
Copied
How many images in each set to combine into a single image?
If you found solutions for horizontal stacks, then they should be able to be easily modified into vertical.
The following current topic stacks sets of 3 images into a vertical strip:
Copy link to clipboard
Copied
The number of images in the folder isn't always consistent. Sometimes there may be 5 images, other times 25, but it won't exceed 50.
I'm at the beginner's stage in scripting, and I tried to modify the file into vertical alignment but it didn't go well.
Copy link to clipboard
Copied
Ah, so the set quantity is based on the source folder file count, not the source folder count divided by a specific set quantity...
If you provide a link to the code for the horizontal stack it can be used as a starting point for the vertical. No need to reinvent the wheel here.
Copy link to clipboard
Copied
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-combine-images-horizontally-vi...
Here is the code for the horizontal stack that I found. Thank you.
Copy link to clipboard
Copied
Thanks, I'll take a look...
Is the width and height of the images always consistent?
Or does the width differ, but the height is consistent?
Or does the height differ, but the width is consistent?
Or are the width and height inconsistent from image to image?
Copy link to clipboard
Copied
The width of the images does not differ, it's only the height that varies.
This is what I expected, I've tried both of the scripts you provided:
Both of them work!
However, since I wanted the layers to remain separate rather than being merged, I prefer the second one. Thank you so much again for your help!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-help-export-merge-many-picture...
This one works!! Thank you so much for all your help ❤
Copy link to clipboard
Copied
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-help-export-merge-many-picture...
This one works!! Thank you so much for all your help ❤
By hamigua
Great! I'd be interested if you could answer the questions in my previous posts and try the script code that I also posted.
Copy link to clipboard
Copied
@hamigua – I made a quick edit to the script that I offered in the topic that you linked to:
/*
Combine Images Vertically.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-merge-3-images-togehter-stacked-in-a-batch/td-p/13922876
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-combine-images-horizontally-via-batch/td-p/12716190
Stephen Marsh, v1.0 - 9th July 2023
*/
$.evalFile(File(app.path + '/Presets/Scripts/Load Files into Stack.jsx'));
var newHeight = app.activeDocument.layers.length * 100;
canvasSize(newHeight);
align2SelectAll('AdBt');
app.runMenuItem(stringIDToTypeID('selectAllLayers'));
distributeVertically();
// Functions
function distributeVertically() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated( s2t( "layer" ), s2t( "ordinal" ), s2t( "targetEnum" ));
descriptor.putReference( s2t( "null" ), reference );
descriptor.putEnumerated( s2t( "using" ), s2t( "alignDistributeSelector" ), s2t( "ADSDistV" ));
executeAction( s2t( "distort" ), descriptor, DialogModes.NO );
}
function canvasSize(height) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
descriptor.putUnitDouble( s2t( "height" ), s2t( "percentUnit" ), height );
descriptor.putEnumerated( s2t( "horizontal" ), s2t( "verticalLocation" ), s2t( "top" ));
executeAction( s2t( "canvasSize" ), descriptor, DialogModes.NO );
}
function align2SelectAll(method) {
app.activeDocument.selection.selectAll();
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
desc.putReference(charIDToTypeID("null"), ref);
desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method));
try {
executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
} catch (e) { }
app.activeDocument.selection.deselect();
}
The script presumes that the height of all layers is the same.

