Easy Way to Automate Photoshop with Variables (Part 7)

Easy Way to Automate Photoshop with Variables (Part 7)

We will continue our journey with Variables and Data Sets. In this post, I will explain you why and how to use external Data Sets. When I say: external, I meant prepared in advance Data Sets and saved as a text or csv file. With external Data Sets, you can save tons of time and skip many steps  required when manually creating Data Sets as we have covered in the previous posts.

What is so great with external Data Sets files

First of all, you can save tons of time. Instead of manually creating Data Sets, you can use flexible naming conventions and re-use same external files over and again. Spend some time to create external Data Sets files, and you are done probably for the rest of your life. You can use Microsoft Excel as a helper and greatly reduce the time.

Second: you can create randomly arranged references for Pixel or Text Replacement variables. Randomly arranged references can help you to create unique and creative effects or to get job done quickly under pressure or deadline. If you want to have external Data Sets for just any situation and purpose then consider using Random Sorter for Microsoft Excel.

Third: preparation of external Data Sets is more or less, one-time process. Spend some time thinking and planning and chances are that you will create re-usable files. With small modifications, you can use same Data Sets in the next couple of years.

Real World examples
I have prepared external Data Sets files to provide you for practice and to follow along. For some real World samples, I am providing you links to some of my published products:

Vintage and Watercolor Wedding Invitation Set. Pixel, Visibility and Text replacement variables in use.

Automated Texture Creator. Randomly arranged references to files for Pixel Replacement variable. I am using those files for some of my freebies and premium products.

Centered & Heart Collages. I am providing external Data Sets files with randomly arranged references for Pixel Replacement variables.

Unlimited Layouts. Very useful and flexible files for mass processing but also and to create catalogs, photo books, contact sheets ... Test or trial files contain PDF document which has lots of useful information's, screenshots and video instructions.

How things works with external Data Sets

Before we proceed to practice section, I want to explain you how things works. You must have prepared files in advance. External Data Sets files can be saved as comma separated (.csv) or tab delimited (.txt). Most of the time I am using tab-delimited text files. In order to use files with external data sets your PSD file must have the same number of variables defined and variables must have same names.

When you load external file, Photoshop will look if variables are matching.
External Data Sets must have matching variables

After finding matching variables in the external file, Photoshop will start executing line by line.
Photoshop is executing line by line from external Data Set file

Each line in external Data Sets file contains information about visibility, text for replacement or reference to file for replacement. You can set Visibility, Text Replacement and Pixel Replacement variables.

For the Pixel replacement variables, you must reference to file with same name and extension as it appears on your hard drive. It is not necessary to provide a path to the file, only file name with requirement that file with Data Sets and files for Pixel Replacement lives in the same folder.

What to bear in mind when creating external Data Sets files
No spaces are allowed at the beginning and end of each line. From my experience, you must double check end of the lines when using Microsoft Excel as a helper.
No space is allowed at the beginning and end of the lines in external Data Sets files

Encoding must match. Use Automatic encoding. If you change Automatic encoding to something else then ensure that encoding of external data set and encoding set from Encoding drop-down are exactly the same. You should check encoding method when saving files. Photoshop will display an error message even when everything is set correctly just because encoding method does not match. When importing external Data Sets files the user can change encoding method from Encoding: drop-down list in Import Data Sets dialog. Safe zone especially when creating files for distribution is to save tab-delimited files with Unicode UTF-8 encoding. Do not forget to write a reminder or help files if you are going to share files.

Extension for Pixel Replacement variable must match. Besides the name of the file for Pixel Replacement variable, extension of the file (.jpg, .psd) must match too. The good news is that it is easy to change the extension using Find/Replace command.

Tips for flexibility and to speed up process
Use default naming convention when defining variables in Photoshop and when creating external Data Sets files. The default naming convention will reduce the time to define variables.

Always use the same naming convention for variables. Same naming convention for references files for Pixel Replacement like: image_sequence number will allow you to modify quickly and use any of created external Data Sets in any situation and for any purpose.


Let's do some practice with external Data Sets. To follow along with me download Free Filmstrip Automated PSD Templates. I have prepared Data Sets in advance for this post, and you can download them from here.

Prepare files
The very first task is to prepare image files. We will work with JPG images. Find 21 images you like. Rename images to: Image_0001.jpg ... Image_0021.jpg (here is a step by step tutorial, steps 1-3). Copy and paste: 3 images.txt, shuffle 3 images.txt and 3 from 21 images.txt in the same folder with renamed images. Text files you will find inside the folder: Data Sets, which you have downloaded from the above link.
Folder view with images and Data Sets

Step 1 Assign Pixel Replacement variables
Open Filmstrip 1 horizontal.psd template in Photoshop. Duplicate template from Image > Duplicate then delete Filmstrip 2 layer group.
Layers panel after deleting Filmstrip 2 layer group

Go to Image > Variables > Define and assign Pixel Replacement Variable for layers: image_1, image_2 and image_3 (here is tutorial, steps 4 and 5). Accept default naming convention: PixelVariable1-3 and change Method to Fill.

Step 2 Import external Data Sets
In this step, we will import files with external Data Sets. After defining variables, you should click the Next button on the right side.

  1. Click on Import button.
  2. Click on Select File button and navigate to the folder with images and Data Sets. Double click on 3  images.txt file.
  3. From Encoding: drop-down list choose: Unicode (UTF-8).
  4. Click OK button. Turn on Preview on the right side in order to see placed images instantly. In case you cannot see images, try checking and unchecking Preview.
  5. Click on the Go to next data set button couple of times. With each new click, you should see new images placed in your template.
Steps to import Data Sets

Step 3 Import other two Data Sets
Do not close Variables dialog. Click on Import button and repeat process to import shuffle 3 images.txt and 3 from 21 images.txt. Use Go to next data set button to preview imported Data Sets and to see the difference.
Preview template with all external Data Sets files to see the difference

Step 4 Export Data Sets
Load 3 images.txt file and click OK button in Variables dialog. Export available Data Sets as explained in Easy Way to Automate Photoshop with Variables (Part 2) - step 11. Here is solution how to remove sequence numbers and empty spaces from the file name.


Congratulations, if you are reading posts from my series about Variables then you know, more or less everything about this amazing feature. The next step is to start using Variables in every situation that is appropriate. After some time, you will get necessary experience, and you will master Variables in Adobe Photoshop.

All posts in this mini-course
Easy Way to Automate Photoshop with Variables
Easy Way to Automate Photoshop with Variables (Part 2)
Easy Way to Automate Photoshop with Variables (Part 3)
Easy Way to Automate Photoshop with Variables (Part 4)
Easy Way to Automate Photoshop with Variables (Part 5)
Easy Way to Automate Photoshop with Variables (Part 6)
Easy Way to Automate Photoshop with Variables (Part 7)
Why and How to Combine Text/Pixel Replacement Variables With Visibility Variables in Photoshop

Product used in this tutorial:
Adobe Photoshop CC 2014

Photoshop Help / Creating data-driven graphics


Popular posts from this blog

Free Puzzle Pieces Actions For Photoshop and Elements

How to Change Artboard Size in Adobe Photoshop

Old Weathered Vertical Wooden Planks Free Image