Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Learn to composite graphics in Adobe Photoshop using variables and a simple text file. This Design the Web installment shows how to automate your production workflow by combining separate graphic files, typography, and Photoshop effects into custom, ready-to-use graphics. This workflow allows you to generate hundreds, even thousands, of unique graphics suitable for websites, interactive projects, or even print. All you need to begin is a layered Photoshop file.
The Design the Web series was created and produced by Chris Converse. We are honored to host this content in our library.
Now we're going to create an external text file, or a CSV file that's going to hold all of the values for a data set external from the Photoshop file. So first let's switch back to our Exercise Files, and let's come over here and open banner_data.csv up in a text editor. Now as I mentioned earlier, this is just a text file, and it's largely blank except or this little sentence here. So let's come in here and delete this, and what we need to do define our data set in this CSV file or comma separated value file is to define all of the variable names and we're going to separate those by a comma.
And these need to match what the variable names are inside of Photoshop. So let's start with city comma space then price. Then a comma, space, then photoBase. Comma, space and then photoClip. So again, these variable names separated by a comma, match exactly the variable names that we defined inside of Photoshop. So now every line after is going to define a data set. So let's hit a Return, and we're first going to define the same data set for Aruba. So let's start with the city name. So let's type Aruba, then a comma, then $649, then a comma.
Then we're going to point to the Aruba JPEG, which is inside of the photos directory. So we'll type photos/aruba.jpeg. Comma, space. And then we're going to assign this same JPEG to the photo clip. So photos/aruba.jpg. Once that's in place, choose File > Save. Let's come back to Photoshop. Let's come under the Image menu. Let's come down to Variables. Let's come down to Data Sets. And what we're going to do inside of this dialog box now, is import custom sets of data.
Let's come over here to the right, let's choose Import. And from the Import Data Set, let's come here and choose Select File, from the desktop > Exercise Files, let's choose banner_data.csv, then click Open. Next inside of the Import Data Set dialogue box. Let's come down here and choose use First Column For Data Set Names, that way the city name will also be the data set name. And let's choose Replace Existing Data Sets, then click OK, so now we can see we have a data set named Aruba. And if we look down here we see all of the exact same value names, and we can also see the same data showing up here.
So now we have Photoshop doing the same thing we were doing before, but instead we're loading the data from that text file. So now let's click OK here. Let's go back to our text file and let's define another data set. So let's hit a Return. This will create another data set. Let's type in, Washington, D.C. Now Washington D.C. does have a comma in the file name and we'll talk about that in a moment. So after D.C. we'll hit a comma space, $699. Comma, space. Let's point to the Washington D.C. JPEG. So, photos/washingtondc.jpg.
Comma, space And then we'll point to the same JPEG file for the second time for photoClip variable. So now let's hit Save here, so let's go back to Photoshop. Let's come under the Images menu, down to Variables then Data Sets. Let's come over here to the right choose Import, Photoshop will remember the last file, so you can simply click OK here. And then we're going to get this dialogue box here, which is going to tell us that there are too many variables inside of here. So the problem is that Washington DC has a comma in its city name. Now this is confusing Photoshop because it's using commas to separate the values.
So let's choose OK here. Let's leave the Variables dialogue box up. Let's comeback to our text file, and what we need to do is somehow specify to Photoshop that this is the full name of that variable. So what we can do is come in here and put quotes around Washington D.C. This basically turns this into a string literal. So we're telling Photoshop, this is the value inside of the quotes of the first variable for city. Let's hit Save. Let's go back to Photoshop inside of our Variables dialogue box. Choose Import, click OK.
Now Photoshop sees the string literal of Washington D.C. as one value for the variable name. Now, it's a C multiple data set, so let's come over here next to Aruba. Let's click on this drop-down menu and now we'll see a representation of each data set in this drop-down menu. So if I just choose Washington D.C. On the main stage we can see the background graphic changes, the text for Washington D.C. changes, and the price changes. So now, in this Variable dialog box, we can switch between Aruba, which will pull in different JPEGs and different prices and city names, and Washington DC. So now, with our data sets working properly, let's come back to our text editor and let's add in some more data sets.
After the Washington D.C. data set, let's hit a Return and let's come in here and add three more. We'll start first with San Francisco. Let's set the price of this to $749. Then we'll point to the San Francisco JPEG file, two times. Once for the photoBase variable, once for photoClip. Next, the city's going to be Breckenridge. We'll set the price on that to $899, and then we'll point to the breckenridge.jpg file, again, both for the photoBase and the photoClip variables. And then lastly, Amsterdam. We'll set that price to $950.
And we'll point to the Amsterdam.jpg for both of the photo variables. Once that's complete, save your text file to Photoshop. Inside of the Variables dialog box, let's come down and choose Import again. Click OK. Again, Photoshop remembers that text file. And now, when we come over here to the Data Sets drop down, we'll see all of the different data sets. So, lets choose San Francisco. Then Breckenridge. Now inside of Breckenridge. Since we have a lot of white snow at the bottom. I, I put a blue fated bar in the actual JPEG file itself. So, this is giving us the illusion of an extra design element but it's actually in the JPEG.
And then lets come down and choose Amsterdam. Now, at this point, we have five completely customized banners being generated from Photoshop and that external data. Now one thing you'll notice is that all these banners have the same elements. They all have the city, the price and the two photographs. Next we'll talk about how to add some unique elements into the individual banners and then turn those elements on and off based on those data sets.
There are currently no FAQs about Design the Web: Automating Web Graphics.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.