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

How to create one big PNG image from multiple PNG images?

Explorer ,
Sep 02, 2021 Sep 02, 2021

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?

 

 

 

TOPICS
Actions and scripting , Windows

Views

4.8K

Translate

Translate

Report

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Some existing scripts include...

 

You can make an image grid with a single row or column:

 
Or one of the scripts from @JJMack:
 
There are likely many more scripts that may suit your task or can be modified for your task, the two above were just the first that came to mind.
 
Good luck!
 
P.S. lucky this is under the 300,000px limit!
 

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Thanks I will try!

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

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

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

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?

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

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?

Votes

Translate

Translate

Report

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 ,
Sep 03, 2021 Sep 03, 2021

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.

image.png

image.png

JJMack

Votes

Translate

Translate

Report

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 ,
Sep 02, 2021 Sep 02, 2021

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.

 

JJMack

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Thanks for the info, I will try all the options.

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Yea I have transparent PNG and I have trouble to allign them

Votes

Translate

Translate

Report

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 ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Did you try the 1% work around?

JJMack

Votes

Translate

Translate

Report

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
Explorer ,
Sep 09, 2021 Sep 09, 2021

Copy link to clipboard

Copied

I succedded with Adobe Photoshop - Scripts Related to Montaging and just manually align 35 PNG

Votes

Translate

Translate

Report

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
Guide ,
Sep 02, 2021 Sep 02, 2021

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.

2021-09-03_01-27-36.png

Votes

Translate

Translate

Report

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
LEGEND ,
Sep 02, 2021 Sep 02, 2021

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

Votes

Translate

Translate

Report

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 ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

+1!

Votes

Translate

Translate

Report

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 ,
Sep 02, 2021 Sep 02, 2021

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.

JJMack

Votes

Translate

Translate

Report

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
Guide ,
Sep 02, 2021 Sep 02, 2021

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.2021-09-03_09-04-06.png

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

That seems easy enough, I will try, thanks!

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

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?

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

I found solution

Votes

Translate

Translate

Report

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
Explorer ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

I have an error saying "cannot distribute vertically because the result would be too big"

Votes

Translate

Translate

Report

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
Guide ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Wow, it turns out there is a limitation! Then the problem cannot be solved without a script ...

Votes

Translate

Translate

Report

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 ,
Sep 03, 2021 Sep 03, 2021

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

 

Votes

Translate

Translate

Report

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 ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

@rickyzg 

 

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.

Votes

Translate

Translate

Report

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 ,
Sep 03, 2021 Sep 03, 2021

Copy link to clipboard

Copied

Did not work for me.

Capture.jpg

This Did

Capture.jpg

where this did not

Capture.jpg

JJMack

Votes

Translate

Translate

Report

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