At SMT I was part of several projects to process head shots. Each project was slightly different and had varying requirements. From these experiences it seems that the following were true for all broadcast projects requiring head shots of the athletes:
- Few designers or artists were prepared to batch process images in a repeatable manner
- due to item 1 above, few designers wanted to process head shots at all
- manual preparation of images causes inconsistencies between subjects such as
- disproportionate features between subjects
- poor alignment between poses and subjects
To address these issues, I developed a repeatable pattern that I could script using Photoshop’s API for JavaScript. This post goes into detail on the journey to create a flexible script utilizing Photoshop’s built-in features.
Previous Method: PS Actions
The tools available to artists using Photoshop are very good out-of-the-box. The actions panel set of tools is very comprehensive. The actions that were in use for the project I worked on for Professional Fight League (PFL) were used to process several poses for each fighter and often several deliverables for each pose. My contributions to PFL’s 2023 season included what we call, internally, the Fighter Card which used one deliverable of the fighter poses.
Here is an example of using one of the actions:
Overview of the Action:
- Open the image
- mask
- open a template PSD
- manual reposition the image according to the proportions of the sample fighter
- resize and add effects and process a few deliverables
- reposition for a final deliverable
- close
Drawbacks to this PS Actions:
- Hand off to another artist requires them to edit the action in order to load the PSD template and save the image deliverables
- requires the user to be present for each image that is processed
- the editable intermediary file isn’t preserved
- if the mask needs to be improved, one must restart the action from the source image
- if the alignment must be adjusted, one must restart the action from the source image
- each export at each size must be re-run
- Cannot pause or stop and resume progress if run as a batch
- Action is very specific to the project and a new one with accompanying PSD templates would have to be created for each deliverable
- Deliverable export directory is fixed and can’t be easily edited in between projects.
- Actions are pose-specific


A Better Option: Custom Scripting
Upon observing the PFL project and others where head shots had to be processed, the repeatable steps were as follows:
For each image of a kind
- prepare a template according to a kind
- determine where subject limbs or body are to scale to fit
- determine where subject limbs or body are to align
- Open Image of kind
- resize subject
- depending on deliverable, sizes vary
- resize according to subject limbs or body position
- align
- align key subject limbs or body position to template
- export Deliverable
- repeat 1-5 for each deliverable of currently open image
- repeat 1-6 for each image of a kind
- repeat 1-7 for each kind
The above is the basis for what I am calling BatchActions.
BatchActions

In theory, any tool or add-on for Photoshop will add functionality on top of existing tools instead of re-inventing an existing feature. This script in its current form utilizes the actions pallet, a user-facing feature that’s well-documented, and runs user-defined actions for each image of a kind. For head shots generally, it has to do with the subject’s position and the intended deliverable format.
The image to the right or below is an example where an original image, however it’s processed prior to BatchActions becomes a preserved source document for ongoing use. These files that are ready for export to deliverables are the files I’m targeting for use within BatchActions
For this image’s example, the fighter is posed as “crossed” and each crossed image of all fighters gets 6 deliverables at various sizes, treatments and styles.

Each fighter had up to [X] deliverables with each of the poses shown here.
[show poses and deliverables]
How does it work?
For the PFL project, each source image has to have some kind of treatment from the original, to a masked image without a background (perhaps using standard batch action within photoshop), and then some sort of standardization treatment.
Standardization, what I mean by this is some sort of predictability for scale between subjects and resizing. At first when I used BatchActions as a test for PFL images, I had to, for example, resize all crossed poses where the mid-thighs all aligned to some invisible guide. This was so a template Photoshop action could run and predictably crop and resize. This is a method of standardizing the image.
[show example?]
Later on I added custom auxiliary functions to the script to be called when applicable. The functions included using named layers as paired anchors for scaling and alignment. This kind of standardization is much more flexible in that a user identifies anchors on a template and in an image and then uses the custom functions to scale and align as needed.
[animation of a template action creating the template size, drawing lines, then scaling image, show the math, then align, also showing the math]
It’s up to the user to determine how they’d like to standardize their files so the subject may be inserted into the template.
The script asks the user for:
- instructions which house keywords, sub directories to save files within, the action to run, and
- an auxiliary file to add additional steps after the action runs. This auxiliary file has the custom function instructions.
- Source folder. This folder has all PSD files and no sub-directories.
- Base export folder. All sub folders are created and files are saved here.
BatchActions works in the following basic steps:
- Create sub folders from all lines in the instructions
- Open the first image that matches the first keyword.
- Create a list of which deliverables to create for the open PSD.
- For each deliverable that applies, do the following (though the steps may be customized)
- Run an action
- Run auxiliary steps which may include any or multiple instances of the following:
- Scale image to the template
- Align image to the template
- Run another action
- (potential feature) Add text to the end of the deliverable filename to be exported
- (potential feature) Add text to the beginning of the deliverable filename to be exported
- (potential feature) Substitute text in the deliverable filename to be exported.
- (potential feature) export another file type.
- (potential feature) conditional logic that isn’t already available in the actions pallet.
- if the distance between a set of variables is larger than, smaller than, equal to a number or distance between a second set of variables, then perform auxiliary set of instruction else perform another set of instructions
- if a named layer [exists, doesn’t exist] then perform some set of auxiliary instructions.
- if the string of a named layer [equals, doesn’t equal] some other string, then perform some set of auxiliary instructions.
- Export a png of the deliverable
- Then, one of the following:
- Revert changes of the open PSD and process the next deliverable
- Open the next PSD with the same matching keyword
- Process the next set of files and deliverables according to the next keyword in the list.

How Could The Script Improve?
I prefer dock-able add-ons to photoshop that persist through sessions. Where currently, the script has to be installed manually by the user, then it can appear in the menus.
I would like to add UI to all aspects of the setup so the text file instructions are no longer required.
A progress bar or some indication of percent complete and time elapsed.
remember the user’s previous actions and allow saved presets
better error-handling. where currently it stops or gives unhelpful information on what went wrong, I’d like to be able to log the error or better-describe to the user what to do to fix the problem.
Skipping, while the script can skip deliverables that already exist, it has to cycle through each keyword and file before checking the deliverable exists. I would prefer to determine all possible deliverables and their exported names, check whether they exist, then start on the first keyword and image that are incomplete.
Pose and body detection would greatly optimize the user experience where the body of the subject is detectable and then the script aligns to the template accordingly. If the solution were to remain within photoshop, I would want the pose/body detection to cycle through images and embed the pose details within the xmp or metadata of the source image, the script reads the data and either adds the named layer anchor points or just uses the data.
Where initially the scope of the script was to run one action per keyword and only export PNGs, I would like to rework the script to always run a set of auxiliary instructions where an action and export format may be determined.
A batch-by-spreadsheet option: where currently the to-do list, so to speak, is created from the files within the source folder, I would like to be able to specify which files to open and a set of instructions for each image or set of images matching a filter.
0 Comments