Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:08:50+00:00 2026-06-14T20:08:50+00:00

I need to do the following thing. Having multiple png files in folder with

  • 0

I need to do the following thing. Having multiple png files in folder with a naming convention set:
1.png 1_m.png, 2.png 2_m.png (and so on).
The png files have the same width and height (320 x 360 px).

Now the script should do the following:

take the files 1.png 1_m.png and create a new file in which the 1_m.png is placed on the left and 1.png on the right merge those two on one layer and save it as lets say 1_done.png,
run this action on all files in the folder.

This doesn’t have to be a Photoshop script I’ve searched the web but couldn’t find any useful solution. Also nothing is set in stone here, the files could be in different folders what ever would be the simplest solution.
My Photoshop version is CS5

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:08:51+00:00Added an answer on June 14, 2026 at 8:08 pm

    This script will do what you want. Put all the files in a directory and then run the script using automate batch -> script. It’ll find an image without and underscore in the the file-name and then open it’s paired name file (with “_m”), put them side by side and save it out with _done added on to the file-name.

    //pref pixels
    app.preferences.rulerUnits = Units.PIXELS;

    var srcDoc = app.activeDocument;
    
    // call the current document
    var srcDoc = app.activeDocument;
    
    // set original width and height
    var imageW = srcDoc.width.value;
    var imageH = srcDoc.height.value;
    
    // get the info out of the source doc
    var fileName = srcDoc.name;
    var docName = fileName.substring(0,fileName.length -4);
    var filePath = srcDoc.path.toString();
    var fileExt = fileName.substring(fileName.length -4, fileName.length);
    
    var nameCheck = fileName.substring(0,fileName.indexOf("_"));
    
    if (nameCheck <1)
    {
       // no underscore so we need to open it's namesake
       // alert(nameCheck)
       var filePair = filePath + "/" + docName + "_m" + fileExt;
       openThisFile(filePair)
       activeDocument.selection.selectAll()
       activeDocument.selection.copy();
       app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
       app.activeDocument = srcDoc;
       activeDocument.resizeCanvas(imageW *2, imageH, AnchorPosition.MIDDLELEFT);
       selectRect(0, imageW, imageW*2, imageH)
       activeDocument.paste()
       activeDocument.flatten();
       var newName = filePath + "/" + docName + "_done" + fileExt
       saveMe(newName)
    }
        else
        {
          app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
        }
    
    
    function openThisFile(masterFileNameAndPath)
    {
     var fileRef = new File(masterFileNameAndPath)
     if (fileRef.exists)
     //open that doc
     {
        app.open(fileRef);
     }
     else
     {
        alert("error opening " + masterFileNameAndPath)
     }
    }
    
    
    function selectRect(top, left, right, bottom)
    {
        srcDoc.selection.deselect()
        // =======================================================
        var id1 = charIDToTypeID( "setd" );
        var desc1 = new ActionDescriptor();
        var id2 = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var id3 = charIDToTypeID( "Chnl" );
        var id4 = charIDToTypeID( "fsel" );
        ref1.putProperty( id3, id4 );
        desc1.putReference( id2, ref1 );
        var id5 = charIDToTypeID( "T   " );
        var desc2 = new ActionDescriptor();
        var id6 = charIDToTypeID( "Top " );
        var id7 = charIDToTypeID( "#Pxl" );
        desc2.putUnitDouble( id6, id7, top );
        var id8 = charIDToTypeID( "Left" );
        var id9 = charIDToTypeID( "#Pxl" );
        desc2.putUnitDouble( id8, id9, left );
        var id10 = charIDToTypeID( "Btom" );
        var id11 = charIDToTypeID( "#Pxl" );
        desc2.putUnitDouble( id10, id11, bottom );
        var id12 = charIDToTypeID( "Rght" );
        var id13 = charIDToTypeID( "#Pxl" );
        desc2.putUnitDouble( id12, id13, right );
        var id16 = charIDToTypeID( "Rctn" );
        desc1.putObject( id5, id16, desc2 );
        executeAction( id1, desc1, DialogModes.NO );
    }
    
    function saveMe(fPath)
    {
    
    // save out the image
    var pngFile = new File(fPath);
    pngSaveOptions = new PNGSaveOptions();
    pngSaveOptions.embedColorProfile = true;
    pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
    pngSaveOptions.matte = MatteType.NONE; pngSaveOptions.quality = 1;
    activeDocument.saveAs(pngFile, pngSaveOptions, false, Extension.LOWERCASE);
    
    // close that saved png
     app.activeDocument.close()
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do the following thing: var a = from c in DB.Customers
I'm having the following problem in python. I need to do some calculations in
I have a pretty complex Linq statement with multiple joins, but am having a
I need to do the following things for a text file..and insert the seeked
I think I might need to do something like the following pseudo-code in my
I need following function (from C++ dll) available in C++/CLI extern C _declspec(dllexport) void
I need following namespaces to use native wpf property grid however, VS 2010 doesn't
I need the following C function in Python: int func(Uint8 *bytRecvBuffer, int *iRecvLen); I
I need the following xml to be made in code: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:gravity=right
I need the following authentication script finished. I am weak at php/pdo so I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.