Copy link to clipboard
Copied
I have 453 PNG images and every image is 580x580px. I need to stack all of the images on 580x262740px.
Doing manually takes too much time, is there any way to do it automatically?
Copy link to clipboard
Copied
Some existing scripts include...
You can make an image grid with a single row or column:
Copy link to clipboard
Copied
Thanks I will try!
Copy link to clipboard
Copied
Now I am doing with this script Adobe Photoshop - Scripts Related to Montaging so I will post later if successful
Copy link to clipboard
Copied
Ok so script was successful but problem is that is added dark background to my transparent PNG, how to do it without adding a background?
Copy link to clipboard
Copied
I used Scripts_Related_to_Montaging but didn't align properly PNG, Is there a way to align 453 PNG fast way after they are in a vertical document?
Copy link to clipboard
Copied
If it did not align because your Png files subject matter has transparent border(s) eliminate that issue remove them I batch an action to do that. Batch will overwrite your png files they will not have any transparent borders but will look like they do. After that use my script or the Scripts_Related_to_Montaging.
Copy link to clipboard
Copied
If you just need to stack them the canvas size would be 580x580 you could use Loads files into a stack. You seem to want to distribute the layer down a narrow tall canvas that is near Photoshop limit of 30,000px. My script should be able to do that. However, the way my script works its does a copy and Paste Into Between documents. The 580x262740 document would have a White Background layer the Png Image layer would be pasted into the document over the document casvas and masked to appropriate 580x580 px area by "Paste Into". The thing is I believe if a png is copied to the clipboard has any transparent boarders the boarders will not be copied to the clipboard only the PNG subject pixels are copied to the clipboard, In effect the png is trimmed to its subject matter. If I'm right your png images may no align the way you want then aligned by Paste Into. You would need to write a script to place in your 453 pngs and distribute them over the canvas. Or you may be able to use Load Files into a stack to a stack to stack your Pngs then Add canvas to the height and distribute the stack of png images.
I think any png that has any transparend boarder its subject matter would be centered in that Pasted 580x580px tile area.
Copy link to clipboard
Copied
Thanks for the info, I will try all the options.
Copy link to clipboard
Copied
Yea I have transparent PNG and I have trouble to allign them
Copy link to clipboard
Copied
Did you try the 1% work around?
Copy link to clipboard
Copied
I succedded with Adobe Photoshop - Scripts Related to Montaging and just manually align 35 PNG
Copy link to clipboard
Copied
you can simply create a document with a size of 580x262740px, drag all the files into it. Place the lowest layer at the top of the frame, the last one at the bottom, select all layers and use distribute function to automatically fill the frame vertically.
You can do it manually or record an action without any problems. Script not needed.
Copy link to clipboard
Copied
I'm used to scripting so much I forgot I was doing this trick myself in the past as well loll
Copy link to clipboard
Copied
+1!
Copy link to clipboard
Copied
Because their files are 580x580 px png files that may have transparency when they are loaded into a stack or dragged into a stack I think their layers bound may not be the 580x580 px square canvas bounds the png file canvas has the layer bound may be just the png subject bounds. It my be interesting how distribute layers works then.
Copy link to clipboard
Copied
When we drag a file into the working area of the document, Photoshop creates a smart object. The outer rectangle of placed file is determined by file boundaries, not transparency.
Copy link to clipboard
Copied
That seems easy enough, I will try, thanks!
Copy link to clipboard
Copied
I noticed that when I create a document the background is white, how to create a doc 580x262740 that has transparent background?
Copy link to clipboard
Copied
I found solution
Copy link to clipboard
Copied
I have an error saying "cannot distribute vertically because the result would be too big"
Copy link to clipboard
Copied
Wow, it turns out there is a limitation! Then the problem cannot be solved without a script ...
Copy link to clipboard
Copied
@rickyzg wrote:
I have an error saying "cannot distribute vertically because the result would be too big"
Stack again, but only half the files. Distribute them.
Stack the remaining half of the files to another doc and distribute them.
Resize the canvas and combine to work around the error/limit of distributing too many files.
You may need to keep working in smaller sets to avoid the error.
It would be good to know what the limit is to remove the guesswork...
Copy link to clipboard
Copied
Please try the following script, test with a folder containing a smaller set of images first to ensure that this works as desired. Files are stacked in alpha/numeric sort order.
/*
Files to Vertically Stacked Layers.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-create-one-big-png-image-from-multiple-png-images/td-p/12359415
How to create one big PNG image from multiple PNG images?
Stephen Marsh
v1.2, 20th June 2022
*/
#target photoshop
if (app.documents.length === 0) {
(function () {
// Save the current dialog display settings
var savedDisplayDialogs = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
// Capture the original ruler units and set the ruler units to pixels
var origUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// Select the input folder
var inputFolder = Folder.selectDialog('Please select the input folder:');
// Test if Cancel button returns null, then do nothing
if (inputFolder === null) {
app.beep();
return;
}
// Supported file formats
var inputFiles = inputFolder.getFiles(/\.(jpg|jpeg|tif|tiff|png|psd|psb)$/i);
// Alpha numeric sort
// inputFiles.sort().reverse;
inputFiles.sort();
// Process the first "base" file
var firstFile = app.open(File(inputFiles[0]));
var firstFileName = app.activeDocument.name;
app.activeDocument.duplicate("Vertical-Stacker", false);
firstFile.close(SaveOptions.DONOTSAVECHANGES);
var docStack = app.documents[0];
app.activeDocument = docStack;
docStack.activeLayer.name = firstFileName;
// Process the remaining file layers to the "base" file
for (var i = 1; i < inputFiles.length; i++) {
var remainingFiles = app.open(File(inputFiles[i]));
var fileName = remainingFiles.name;
var aggregateHeight = activeDocument.height.value;
remainingFiles.activeLayer.name = fileName;
remainingFiles.layers[0].duplicate(docStack, ElementPlacement.PLACEATBEGINNING);
remainingFiles.close(SaveOptions.DONOTSAVECHANGES);
relativeCanvasSize(true, aggregateHeight);
align2SelectAll('AdCH');
align2SelectAll('AdBt');
}
app.runMenuItem(stringIDToTypeID("selectAllLayers"));
reverseLayerStack();
app.activeDocument.flatten();
app.beep();
alert(inputFiles.length + ' files vertically stacked!');
// Restore the dialogs
app.displayDialogs = savedDisplayDialogs;
// Return the original ruler units
app.preferences.rulerUnits = origUnits;
// Functions
function relativeCanvasSize(relative, height) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
descriptor.putBoolean(s2t("relative"), relative);
descriptor.putUnitDouble(s2t("height"), s2t("pixelsUnit"), height);
descriptor.putEnumerated(s2t("vertical"), 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();
}
function reverseLayerStack() {
var idreverse = stringIDToTypeID("reverse");
var desc4653 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref2335 = new ActionReference();
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
ref2335.putEnumerated(idlayer, idordinal, idtargetEnum);
desc4653.putReference(idnull, ref2335);
executeAction(idreverse, desc4653, DialogModes.NO);
}
})();
} else {
alert('Please close all open files before running this script...');
}
EDIT: 20th June 2022 – Code updated to 1.2 version from feedback.
Copy link to clipboard
Copied
Did not work for me.
This Did
where this did not