New | ImageReady CS introduces data sets. What exactly is a data set? The ImageReady Help file tells us that a data set is a collection of variables and associated data, and, further, that you can switch between data sets to upload different data into your template. But what, exactly, does that mean? It s a whole lot easier to show you than to try to explain it. |
Follow these steps to create some ImageReady data sets:
In ImageReady, open the file headshots.psd from the ch26 folder on the CD. This file consists of five named layers , each containing a small photo, as seen in Figure 26.13.
Figure 26.13: Each layer contains a photo.
Choose Image ’ Variables ’ Define to open the Variables dialog box. From the Layer list, select Darren, as shown in Figure 26.14.
Figure 26.14: The Variables dialog box
Under Variable Type, check Visibility. Leave the Pixel Replacement option unchecked. Notice that an asterisk (*) appears next to the layer name to show that there is now a variable associated with that layer. The dialog box should look like Figure 26.15.
Figure 26.15: Creating a Visibility variable for a layer
Under Layers, select the next layer, Jenn. Click the Visibility option. Continue by selecting each layer in turn and checking Visibility for each of them.
Click the Next button, or choose Data Sets from the drop-down list at the top of the Variables dialog, to begin defining data sets. You should see a data set like the one in Figure 26.16. There are five variables, each of which defines the visibility of one of the five layers in the document (see Figure 26.16).
Figure 26.16: Your first data set
Select Variable2, the variable for the Jenn layer, at the bottom of the dialog box, and check the Invisible radio button under Value, as shown in Figure 26.17.
Figure 26.17: Variable2 set to Invisible
Select each of the remaining variables in turn, clicking Invisible. Leave the variable for the Darren layer, Variable1, set to Visible, as shown in Figure 26.18.
Figure 26.18: Only one layer is visible in the finished data set.
Click the New Data Set button to the right of the data set name, as shown in Figure 26.19. This creates a second data set, called Data Set 2. Each data set has the same variables, but those variables can have different values in each data set.
Figure 26.19: Creating a second data set
In Data Set 2, select Variable1 and change its Value to Invisible.
Select Variable2 and change its Value to Visible.
Repeat steps 8-10 to create Data Set 3, Data Set 4, and Data Set 5. Set the values for each variable so that only Variable3 is set to Visible in Data Set 3, only Variable4 is set to Visible in Data Set 4, and so forth. When all five data sets are complete, press OK to close the Variables dialog box.
Choose Image ’ Preview Document. From the Data Set Options bar, select the various data sets to see the changes (see Figure 26.20). Every data set should display a different layer and photo. You can also scroll through the various data sets by clicking the triangle buttons to the right of the data set name.
Figure 26.20: Reviewing the data sets
What, you might be asking, is all this actually good for? Data sets are most useful for automating the production of large numbers of images, especially when combined with ImageReady s capability to import data sets. Suppose that you maintain the internal website for a company with 500 employees. For each of the employees , you need to create a banner graphic featuring their photo, their name, their department, their employee number, and assorted graphics. That s a lot of Photoshopping!
But data sets can automate that process for you. You can build a template file in ImageReady and then import information about how to change that file, replacing graphics and text, and turning layer visibility on or off.
Suppose that the company personnel department has given you a CD that includes photos of each employee, and a text file exported from their database that includes each employee s name, number, and department. You can use data sets to combine these files with your PSD template to automatically generate a new banner for each employee.
The syntax of the external text file is as follows :
VariableName1<sep>VariableName2<sep>VariableNameN<nl> Value1-1<sep>Value2-1<sep>ValueN-1<nl> Value1-2<sep>Value2-2<sep>ValueN-2<nl>
The first line contains the variable names . Subsequent lines contain the actual variable values for each data set. < sep > can be either a comma or a tab. < nl > is the new line character.
Here is the actual file you ll be using in this exercise:
EMPNUM, DEPT, ITICON, IT_BG, MGMTICON, MGMT_BG, NAME, PHOTO, SUPPORTICON, SUPT_BG 857911, "IT Ctr.", true, true, false, false, "Bob Smith", headshot_Bob.jpg, false, false 400215, "Mgmt.", false, false, true, true, "Darren Smalls", headshot_Darren.jpg, false, false 403320, "Mgmt.", false, false, true, true, "Jenn Sward", headshot_Jenn.jpg, false, false 111203, "Supt.", false, false, false, false, "Moto Sugai", headshot_Moto.jpg, true, true 137684, "Supt.", false, false, false, false, "Alice Rowe", headshot_Alice.jpg, true, true
Note | The variables in an external data file do not have to appear in the same order as they were defined in your PSD, but they do have to have the same names. |
This file contains only five employees, not 500, but the principles are the same. The word true dictates that a given layer will be visible; false dictates that it will be invisible. The number at the beginning of each line, and the quoted text, will all be used to replace text within the image. The .jpg files will replace the image on one layer of the file.
Follow these steps to see how it all works:
In ImageReady, open the file badges.psd from the ch26 folder on the CD. This file consists of 10 layers ”a combination of text, shapes , and a photo, as seen in Figure 26.21.
Figure 26.21: The badges.psd file
I have done the work of setting up the variables for you. Choose Image ’ Variables ’ Data Sets to see them (see Figure 26.22). Notice that I ve named the variables NAME, PHOTO, DEPT, and so forth. These variable names match those in the text data file presented earlier in this section.
Figure 26.22: The data set contains 10 variables.
Click Next to examine the variables themselves . Select the Photo layer. PHOTO is a pixel replacement variable; it controls the actual replacement of the photo on the Photo layer with another image, loaded from disk. Each data set will load a different JPEG file into this layer (see Figure 26.23).
Figure 26.23: Pixel replacement replaces the current layer with an image loaded from disk.
Select the Name layer. NAME is a text replacement variable. It enables the text on this layer to be replaced with new text, in this case, the name of each employee. Examine each layer in turn to inspect the variable associated with it; the layers are listed in Table 26.1. Note that Department Icon is a Layer Set , containing three separate shape layers, and has no variable associated with it.
LAYER | VARIABLE | TYPE | DESCRIPTION |
---|---|---|---|
Name | NAME | Text replacement | This text will be replaced with the actual name of each employee. |
Employee Number | EMPNUM | Text replacement | This text will be replaced with each employee s number. |
Department | DEPT | Text replacement | This text will be replaced with the department name of each employee. |
Department Icon (Layer Set) | no variable | ” | ” |
SUPT SHAPE | SUPPORTICON | Visibility | Determines whether the support department icon is visible. |
IT SHAPE | ITICON | Visibility | Determines whether the I.T. department icon is visible. |
MGMT SHAPE | MGMTICON | Visibility | Determines whether the management icon is visible. |
Photo | PHOTO | Pixel replacement | The image in this layer will be replaced with a new photo from the hard disk. |
IT BG | IT_BG | Visibility | Determines whether the I.T. department background is visible. |
MGMT BG | MGMT_BG | Visibility | Determines whether the management background is visible. |
SUPT BG | SUPT_BG | Visibility | Determines whether the support department background is visible. |
It s time to import those files and create the Web banners. Click Next, or select Data Sets from the drop-down list at the top of the Variables dialog box. Click the Import button and select the file employee_data_set.txt from the ch26 folder on the CD. Check the Use First Column For Data Set Names and the Replace Existing Data Sets options, as shown in Figure 26.24. By selecting Use First Column For Data Set Names, you tell ImageReady to create data sets whose name is the same as the value of the first variable in the data file, in this case the employee number, rather than Data Set 1, Data Set 2, and so forth. Click OK.
Figure 26.24: The Import Variable Data Sets dialog box
To review the data sets, click the two triangle buttons to the right of the data set name, as shown in Figure 26.25. Notice that ImageReady loads in new photos, changes text, and hides and reveals graphics elements.
Figure 26.25: Scrolling through the data sets
Press OK again to close the Variables dialog box.
From the Optimize palette, choose JPEG Medium from the Presets list.
Choose File ’ Export ’ Save Data Sets As Files. In the Export Data Sets as Files dialog box, click the Set button under File Options to tell ImageReady what to name your new images. Choose Data Set Name from the first drop-down list. Leave the last drop-down list set to .ext, and set all the other lists to None, as shown in Figure 26.26. Click OK.
Figure 26.26: Data set file naming
Choose a destination for your new images to be saved to. Under Save Options, select All Data Sets from the Data Set list, Optimized from the Save As list, and Images Only from the Export list. The dialog box should look like Figure 26.27. Click OK to export the files. ImageReady creates five new images in your destination directory. Each file will have the same name as the employee s employee number, plus the .jpg extension, as shown in Figure 26.28. This exercise created only five Web banners, rather than 500, but the principles are the same.