Using data sets and variables in Photoshop

Standard

This week I’ve decided to post something a little different.

Working with data in Photoshop (CS3+) is probably not something you’ve thought much about. In fact, I’ve only ever run into one case where using datasets and variables in Photoshop made sense to me, but once you know how to use them, you’re bound to find more and more reasons to use them.

This approach is a timesaver regardless of the amount of data you might have, but if you’ve only got a few lines of data to work with, creating each PSD by hand might save time compared to this method.

Practical Applications:

  • Mailing labels
  • Custom postcards, flyers, etc.
  • Creating ordered price or number-based images
  • And so on…

First, we need some data to work with. For this example, I’ve created a simple list of names and addresses in Google Docs. The first cell of each column is important. We’ll use these names when we define variables to work with in Photoshop later on. Once my spreadsheet is ready, I export the file as a CSV.

Figure 1. Example of demo data as seen in Google

Figure 1. Example of demo data as seen in Google

Your CSV should end up looking something like this.

Figure 2. Your CSV should end up looking something like this.

Once we have our data, we’ll need to create something in Photoshop that can take advantage of it. With a list of names and addresses we could create custom envelopes, postcards, name badges, you name it. For this example, we’re going to keep it simple and create a Galactic Empire email signature graphic/mailing label sort of thingy:

datasetimg3

In the above screenshot you can see I’ve created a pretty basic PSD with the Galactic Empire Logo (Layer 1), five text layers and a plain white background layer. Now comes the fun part. Go to Image > Variables > Define. Select Name from the Layer dropdown.

Select Name from the Layer dropdown

Select Name from the Layer dropdown

We need to make sure that each column of data we have in our spreadsheet coincides with a variable. Select a Layer from the layer dropdown (such as Name). Then check the checkbox next to Text Replacement and set the name to Name, so it’ll match the column name from our spreadsheet. Continue doing this for each column/layer until finished.

Next, we need to create our Data Set.

Next, we need to create our Data Set.

Click the import button and it’ll open an Import Data Set window.

Next, we need to create our Data Set.

Figure 6. Select the CSV file you created.

Select the CSV file you’ve created. Make sure the checkboxes are checked. You’ll also want to make sure that you’ve already created your variable associations and the names match your column headings in the CSV. If they don’t match you WILL get errors.

Figure 7.

Figure 7.

You’ll now be able to select from the various Data Sets you’ve created and your PSD will get updated with the results. Once you click OK, save your document.

Now we’re turn each Data Set into its own PSD. Do this by going to File > Export > Data Sets as Files.

Figure 8.

Figure 8. Export data sets as files.

Select a folder for output. Set your naming convention. Click OK. In a matter of seconds you’ll have PSDs for every single data set.

Once you have a folder full of PSDs, your best bet would be to create an action that Saves for Web and then run a batch process that applies the action to each file. I’ll cover that in my next post.

Original posted on the OnWired blog: http://onwired.com/901/