By the way, each of those images above has a white border, which is why you see white in the final image.
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:
- TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
- CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
- LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
- InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
- ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
- ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
- PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
- BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
- 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.
- BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder
- PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
- PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.
Documentation and Examples