Join Angie Taylor for an in-depth discussion in this video Using variables in Photoshop, part of After Effects: Kinetic Typography Techniques (2011).
In this movie, we're going to have a look at how to use variables to change the content of text layers. Now, I design a lot of text for on-screen graphics, and I'm always looking for ways of streamlining the processes involved. Probably my most dreaded job is having to retype text that's been supplied to me as a text document. Into individual Photoshop layers, so I really want to find a way to automate the process of applying a text document to individual layers. I'm going to share this technique with you now. In here we have 11 Text layers, named one, two, three, four, five, six, seven, eight, nine, ten and 11.
If you want to follow along with me, the file's called 03 variablestart.psd, and you can find that in the Project Files folder within the Photoshop files sub folder. And if you select Text 01, and we're going to start working from there. So we've got 11 layers all stacked on top of each other. Now each layer is identical to the next, same content and the same font settings were used so it looks, really, as if there's only one layer if I switch them on and off it doesn't make any difference.
But I can go to the Layers panel and I can double-click each layer individually, and then Edit the text, so I can then double-click on the Thumbnail. And type in (UNKNOWN), and it replaces the text with my typed text. Now, the only thing with this is then I have to remember to accept the changes, and I accidentally make changes, and I always find that with text layers in Photoshop, I either forget to double-click them so I'm editing nothing. Or I double-click them too much. That's always a bit of a problem. So instead of using that technique I'm going to click on the no entry thank you very much button. So instead of that kind of fiddly and time consuming process, we'll use variables to automate the process.
Now you may not have heard of variables. Variables are traditionally used to apply different versions of data to a template. For example you may have designed a lower third graphic for a news program, featuring the speaker's name and job title. Variables can be used to create multiple versions for each person who'll be speaking. And it does this by referencing a text file with columns containing the five names and job titles of the people speaking. And it applies this data to specified layers in the document.
Sounds tricky doesn't it? Well it is a bit but don't worry once you learn the process of how to use them it won't seem so scary and I can guarantee you'll find lots of other uses for them, particularly if you work in motion graphic design. So to write with variables first thing you need to do is select one of your Layers and go to the Image menu and Choose variables define. And here we have a slightly scary looking dialog box but basically its got Layer Text one selected cause that's the one I selected first. Now you can either vary, the visibility of the layer or the text content. We're working with Text layers, so I want to Choose Text Replacement. And it's automatically going to Choose Text Variable one. I'm going to leave that as it is, and what I want you to do is just follow the process I'm going through, and I'll explain what it means shortly. So, we give text one layer the name of Text Replacement text variable one. Hit the arrow to move forwards, now text 11, click on the check box, and call this Text variable 11.
Continue doing this for all of the layers, so we want ten for ten and each one will have the same number as the layerr now we don't need the zero for nine just the number 9 is fine. Same with eight we just want to replace the two with an 8. seven, and we just go through one by one. Renaming these let me take little bit of time. Now obviously you have to spend a bit time setting this up.
But its kind of like actions, the time that you spend setting up initially you'll be able to save in subsequent projects instead of having to do this in subsequent projects, you'll just be able to automate the process. So Text 02, we have this variable of two so neither are finished. You'll see if I move through them now, they all have numbers. So basically we're assigning a variable to each of our layers. Once you've done that, you click on the Next button. What we want to do now is apply a data set, and what we're going to do here is we're going to have a look at a file that I've already saved, and I'll just explain what that file is. Okay, so I've got a spreadsheet open in Excel here, and the reason is to show you how this is set up.
Basically what you want to do is you want to put, Create columns. Now you can do this in a Text file, but it's easier to see the columns in a spreadsheet, that's why I'm showing you here. And the header of each column, you put in your variable names, in this case it was text variable one, two three, etc. And then underneath that, you need to copy and paste in the text. So this is normally supplied to you as a text document, so you may not need to go through that whole process repeatedly, and if I close down this one you'll see that underneath there's one where I've already done that. So under Text Variable one, I've put the first line of my song, it's June the First Today.
Text Variable two I've put the second sentence, I'm thinking about things that were transient. Text variable three, and things are here to stay. And basically this is the text that I want to be replacing the text within PhotoShop. So basically it just, very, very quick and easy just copy and paste that text into columns, or to format it in columns. And once you've done that if we have a look underneath you'll see that I have a text file. Which has all of those set out, and basically, all it's doing there is wrapping those columns around. So you've basically got the variables at the top and all the text underneath, and that's saved as a file called Lydix.txt, and that's also in the Photoshop files folder.
So if we jump back to Photoshop, what you can do now is import that file. Into Photoshop. So I click on Import, Select the file, and it's called Lydix.txt. So I click on Open, and click on Ok, and you'll see that it's loaded the data in. So I'ts basically got the text variable and then the value. Now, watch what happens behind if I click Apply or Preview. I click on Preview, and it replaces each of the text layers content with the variable values.
Now the nice thing is, I can actually replace that with another file if I want to, and all the text layers will update. So, once I've setup the initial variables for each of the layers, it's really really then to re-update the text. And it's just a case of going into a text document but not dating it, instead of having to go and select individual layers. So that's how to use variables in Photoshop. If I click on OK,, whoops, I forgot to apply it. So if that happens, just go back into variables, into datasets, and all you need to do is just click Apply. If I click apply.
And then click OK. If we soloed the layers by holding down the Alt key and clicking on the variables, you'll see that they have all different content, so each layer has a different amount of content. Now as I said, to edit that, all I would need to do is open up that text layer. And make changes to the text layer and then the whole Photoshop file will be updated. It's really really good way of being able to change very quickly and easily in Photoshop just with the little bit of setting up.
- Working with audio
- Preparing source files
- Structuring your After Effects project
- Working with shapes and effects
- Optimizing performance
- Animating text
- Creating 3D animation
- Using expressions to create motion
- Rendering your final movie