Photoshop Sports Template Automation via JavaScript


This script is designed to batch process sports trading cards from a template document.

The basic operation is prepare a folder of images from a sports event such as a soccer match.   Then apply a template that will make a sports trading card from each image.

A sample template is shown below.

The template document consists of one Layer Set, two text layers, and several image overlay layers.   There should be one template for portrait orientation and one for landscape orientation.   The layer set must be named “TradingCard”.   The text layers must be named “Team Name” and “Player Name”.   This layer set will be updated, resized, and copied to the player image so it must be the same aspect ratio as the target image.   The target would usually be 2.5 x 3.5 inches for a sports trading card.

The player name and team name will be updated from IPTC metadata (PS File Information) in the player’s image.   The player name would be from the IPTC Description field and the team name would be from the IPTC Title field.   If either is missing, it will be ignored.   Thus, the team name could simply be a default in the template file.   All other layers in the layer set will be copied to the player’s image unchanged.   This would typically include your copyright icon or some sort of logo.   Anything outside of this layer set will be ignored.

The IPTC metadata can be easily updated from the PS Info panels.   It can also be updated directly from the Bridge in the Metadata IPTC panel.   I set my Bridge preferences to show the IPTC Description field under the thumbnail preview.   If you are shooting RAW formats, the metadata is stored in the XMP files, so the image doesn’t need to be updated.   This allows me to crop the images in ACR, mark the metadata, and create an entire folder of trading cards with batch automation.


This script needs to be installed to [PSInstall]/presets/scripts/.   For CS1, the script extension must be changed to “.js”.   Whenever new scripts are added here, Photoshop needs to be restarted to enable them.

The location and names of the template files must be edited near the top of the script:

      var templatePath = "/[winDrive]/[myFolder]/";
      var templateFileP = "SportsTemplateP.psd";
      var templateFileL = "SportsTemplateL.psd";
Of course, you also need to copy the template files to this folder.

Next, record an action that will run this script.   Prepare a folder with the desired player images and update the IPTC information.   Then use PS Automate:Batch, set Play to the action just created and select this new folder as the Source.   Set the Destination to Save and Close, or a different folder.   This script will not attempt to save the updated document.

You can also run this script against a single open player image from PS File:Scripts.

Size the images based on your desired target, for example, a standard trading card.   It is most important that the template matches the target aspect ratio.


These scripts are provided as shareware with no warranty, but also no usage restrictions.   You are free to use and modify them.   If you feel obliged to pay something, make a contribution to your favorite charity.   The sample scripts are available at this link in a ZIP file   I have tested this under Windows but there should be no reason that it shouldn’t work the same on Mac systems.  

If you have any comments, or suggestions, I would welcome your input.   Please send me an  Email.

Rags Gardner
Rags Int., Inc.
204 Trailwood Drive
Euless, TX 76039
(817) 267-2554
Send Email
May 29, 2006

This page last updated on:
You are visitor number