6 Replies Latest reply on Jun 16, 2014 6:38 AM by JJMack

    Is it possible to merge images from 4 different folders into a single 4x4 image with ps scripting?

    Braindenizen

      So I have four folders that each contain 970 images.   The images in folder 1 are named exactly the same as the images in folder 2, 3, and 4.   All the images are also 400px in size.   What I'm trying to do is take all images of the same name from each of the 4 folders and put them into a single 800x800 images so that they are arranged in a 4x4 fashion.

       

      Example:  Each folder has an image named mastiff1.psd.  All four mastiff images are different, but have the same name, and are the same size.  I'd like all four mastiff images to be combined into one double-size image that has all four of the mastiff images on it and save as mastiff1-4x4.

       

      Is that something that photoshop scripting could do?  I'm a newb to this.  I've used actions plenty, but never scripting.

        • 1. Re: Is it possible to merge images from 4 different folders into a single 4x4 image with ps scripting?
          c.pfaffenbichler Level 9
          Is that something that photoshop scripting could do?

          Yes.

           

          Could you post a set of four source-images and the intended resulting image?

          • 2. Re: Is it possible to merge images from 4 different folders into a single 4x4 image with ps scripting?
            Braindenizen Level 1

            First, the four images.  Each image is 400x400 pixels.

             

            image1.jpg

            image2.jpg

            image3.jpg

             

            image4.jpg

            And then here's what I want as the result:final-composite-image.jpg

            The final image will be 800x800, so as to fit all four images.  I figure it's probably just a matter of copying image 1, pasting it into the new image, then selecting all and aligning to top and left edges.  Then copying and pasting image 2 and aligning it to top and right edges, and so forth.   Can't figure out how to do this with actions though.

            • 3. Re: Is it possible to merge images from 4 different folders into a single 4x4 image with ps scripting?
              Braindenizen Level 1

              By the way, each of those images above has a white border, which is why you see white in the final image.

              • 4. Re: Is it possible to merge images from 4 different folders into a single 4x4 image with ps scripting?
                JJMack Most Valuable Participant

                To script well you need to know a scripting programming language either JavaScript which works on both Photoshop Platforms or AppleScript which will only Apple Mac machines, Or VSbasic which will only run on windows.  You must also know how Photoshop works and know how  to use Photoshop well.

                 

                There are some things that can not be scripted for Adobe DOM does not have interfaces methods for all of Photoshop's features.  However there is an Adobe Plug-in with the name Scriptlistener witch is like a script recorder anything you do in Photoshop that can be recorded in actions will be recorded into two logs on you desktop when the Scriptlistener plug-in is installed one is in JavaScript syntax the other in VSbasic.   Like Actions there is no logic just hard coded step, step, step...  The code uses the Action Manager to do the Photoshop function.  So things that can not be scripted using Adobe DOM can be scripted using Action Manager code produced by the Scriptlistener Plug-in and the hard coded steps can be modifies into javascript functions that use variables.

                 

                I feel what you want to do would be a real ambitious first Photoshop script.  Adobe scripting documentation, sample script and Scriptlistener  are not part of the standard install. You must download these from Adobe. Adobe Photoshop Scripting | Adobe Developer Connection.

                 

                I don't actually know javascript but I can hack at it. Have done some document layout scripts.  Most require a PSD template but PasteImageRoll does not but all Image must come from the same folder.  Most of my fully automated script require all image to be in the same folder.  However  two of my scripts are interactive.  You can select each image to be layout from anywhere.  Images will be automatically re-sized and positioned which you can then tweak.

                 

                I'm not the best coder still you may want to look ate the code I came up with.

                Paste Image Roll Script and Picture Package Support

                 

                Photo Collage Toolkit UPDATED Made Rotate for Best Fit an option in PasteImageRoll.jsx Edit to customize your default settings.

                Photoshop scripting is powerful and I believe this package demonstrates this.

                The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

                There are twelve scripts in this package they provide the following functions:

                1. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
                2. CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
                3. LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
                4. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
                5. ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
                6. ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
                7. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
                8. BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
                9. BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
                10. BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder
                11. PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
                12. PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.


                Documentation and Examples

                • 5. Re: Is it possible to merge images from 4 different folders into a single 4x4 image with ps scripting?
                  Braindenizen Level 1

                  Thanks JJMack!  I'll take a look at some of this.  The script listener sounds like it might be right up my alley.

                   

                  After I thought about it, I could indeed house my images all in the same folder.   If I were somehow able to 'open next document in folder' in photoshop, I'm sure I could just build an action, which I have plenty of experience with.   Sounds like script listener is to scripting as the action 'recorder' is to creating actions.

                   

                  I was hoping it would be something straightforward.  At it's most simplistic, I figure it could something like.

                   

                  Create new 800x800 file, open first file in folder, select all, copy, paste into 800x800 file, select all, align layer to selection (top left), open next file in folder, copy and paste into 800x800 file, select all, align to selection (top right), open next file in folder, etc, etc.   Closing these files as we go of course, and flattening and saving the image after every fourth image paste

                   

                  Will your script do that if I'm able to get all my files arranged in a folder so that they are in perfect order to be automatically placed as such?

                   

                  Thanks again for your insight and willingness to share with a newb!  I will look at this further.  I'm sure the script listener will be just what the doctor ordered!