Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

a Script or Batch to Vertically Combine Multiple Images

Community Beginner ,
Jul 08, 2023 Jul 08, 2023

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!

TOPICS
Actions and scripting
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jul 08, 2023 Jul 08, 2023

@hamigua 

 

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:

 

https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-merge-3-images-togehter-stacke...

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2023 Jul 08, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2023 Jul 08, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2023 Jul 08, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2023 Jul 08, 2023

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2023 Jul 08, 2023
LATEST

The width of the images does not differ, it's only the height that varies.

화면 캡처 2023-07-09 105832.pngexpand imageFinal.pngexpand imageThis 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2023 Jul 08, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 08, 2023 Jul 08, 2023
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2023 Jul 08, 2023
quote

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 08, 2023 Jul 08, 2023

@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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines