Easy Way to Automate Photoshop with Variables (Part 2)

Easy Way to Automate Photoshop with Variables (Part 2)

In the previous post we have covered the very basic about Variables and Data Sets in Photoshop. In this post I will guide step by step how to use the real power of Data Sets and how to fully automate some repetitive tasks with real World example. It will be easy as pie, of course.

Images used in this tutorial comes from depositphotos. They have excellent search options, related images, but also and images with the same model what is exactly what I need for this tutorial.

Step by step automation with Variables

In this tutorial I will use an example of wedding photographer, but you do not have to be one to follow along and to understand how to use the exact same technique for any project or purpose. We will use two photos, actually one photo repeated twice. Number of photos that can be used does not have any limitation, you can use hundreds if you want. The main purpose of tutorial is to teach you technique and I will keep things as simple as possible.

So, let's say you are wedding photographer and you have a template which you are using over and over again. The template is created from one image which is repeated twice: one larger version of the photo and one smaller in bottom left corner. Let's say you are creating 5 or 10 or 20 compositions for each couple. You can do that in 5 minutes in Photoshop and best of all you can re-use the same template as many times as you want. All you need are photos of some other couple which must be renamed for what you can use Adobe Bridge to rename hundreds or thousands of photos in a second. An introduction is necessary, no more explanations-just steps.

Step 1 Create folder on your drive
First step is to create a folder on your drive where you will place your image for automation. I will name it Wedding Composition.

Step 2 Place image in created folder and duplicate it
Next step is to have images in folder which is previously created. We are going to use that images to create template. Since Data Sets are flexible you can create more Data Sets of what you are usually using, just in case you may need them at some point of time. I will suggest you to use Adobe Bridge. Place one image in a folder and duplicate it 9 times by pressing Ctrl/Cmd + D keyboard shortcut (Edit > Duplicate).
10 images for template

Step 3 rename photos
From the previous post you should be already familiar that Photoshop will store location (path) + file name and extension in Data Set. Photoshop does not have any idea about the content in the file. In particular, you can use, for example, wedding_1.jpg and wedding_2.jpg images when creating the template. Later on you can move or delete that images and place any other two images in the same folder. If you rename images to wedding_1.jpg and wedding_2.jpg, Photoshop will import (place) them in the template without to ask anything. I am mentioning two images but it can be any number of images including 10.000 images.

I will use JPEG images in this tutorial. Although you can use any file format I do not recommend you to use RAW files, images with Camera Raw settings and other files like PDF and EPS, which will force Photoshop to display import dialog what will slow our automation. If you have RAW files and you want to keep maximum quality then simply convert them to TIFF or PSD. The instructions are exactly the same, but pay attention that you must use always same file format with created template.

To rename photos first select them (click on first image, then Shift + click on the last image) then go to  Tools > Batch Rename in Bridge.
Batch Rename

In Batch Rename dialog leave Rename in the same folder under Destination Folder.

Choose from the first drop-down list under New Filenames: Text.
Choose Text from drop down list

Type wedding_ in the text field on the right side.
Type wedding_

From the second drop-down list choose: Sequence Number and leave the default 1 in the middle column.
Choose Sequence Number

From the right side drop-down list choose Two Digits. We are going to work with 10 images in this case and two digits are enough.
Choose Two Digits

Lastly, click on Rename button and you are done.
Click Rename button

You should have 10 images in your folder which are named: wedding_01.jpg to wedding_10.jpg.
Images renamed

Step 4 Create a template
I will open one of images in Photoshop. You will have only one: Background layer to which you can not assign Variable.

I will duplicate the background layer and name it: big. Next I will duplicate big layer and name it: small. Next is to shrink down image on small layer and to position it in bottom left corner.

The next operation is to fill Background layer with white color (select Background layer, then go to Edit > Fill > White).

I will lower the opacity of big layer to 70% and stylize a bit image on small layer. I will use Drop Shadow and Stroke in Layer > Layer Style > option dialog.
Stylize image on small layer

You can choose what you want to do for your template. Important is that you have two layers beside Background layer. In fact, you can even delete background layer if you want. For simplicity, I will recommend you to do exactly what I am doing and later one when you understand how this technique works, create your own template.
Important layers for template

Step 5 Define variables
We must have something which Photoshop can use to place the proper image on proper layer and that's variables. You can treat Variables as labels. We will actually name our variables with Label names. After defining variables we will create Data Sets and point to images. Data Sets will tell to Photoshop: place that image on layer with this label.

Go to Image > Variables > Define. Choose: small from Layer: drop-down list.
Choose small from drop down list

Check Pixel Replacement (click on it once).

Type: Label1 in the text box on the right side of Name:.

Leave Method to Fit and click on the bottom left square next to Alignment. This will set anchor point to bottom left of the image. This means in particular that bottom left of the image will always be in that position. Alignment methods will not be discussed in this tutorial, read more from the official Photoshop help page.
Set anchor point

Now go and choose: big from the Layer: drop down list. Repeat process. This time type Label2 in the text box on the right side of Name: and set the anchor point (Alignment) to center (leave default).

Click on the Next button which is on the right side of the dialog and the dialog will change its interface.

Step 6 Create Data Set
Now we are going to create Data Set. Click on "download button" in the top right corner. Data Set 1 will be created.
Create first data set

With Label1 selected (blue background) click on the Select File button and navigate to wedding_01.jpg image on your drive.

Select Label2 then repeat the process and again navigate to wedding_01.jpg image.
Data Set created

We have first Data Set created which says to Photoshop: put Value on Layer with Name. Value is path to image, its name and extension. Layer is the layer in our document (big and small in this case). Name is defined Variable  (Label1 and Label2 in this case).
Data Set

Step 7 Create more Data Sets
We are going to create more Data Sets. Click on "download button" in the top right corner and that will duplicate current Data Set. You will see Data Set 2 next to Data Set: in the top left corner.
Create Data Set 2

It's time to point to some other image. We are going to use same Variables and layers, but different image. Select row with Label2 then click on the Select File button and navigate to wedding_02.jpg. Next is to select row with Label1, to click Select File and to navigate to same image: wedding_02.jpg.

Keep creating Data Sets as previously explained: "download button", select row with Label1 then Select File button. I will create 10 Data Sets.

When you are done, you should see: Data Set 10 next to Data Set: in the top left corner and next to Select File button path should be pointing to wedding_10.jpg image for both rows: with Label1 and Label2.
10 Data Sets created

Click OK button in top right corner of Variables dialog.

Step 8 Save template
Its time to save our template. Go to File > Save As and save it as PSD file and name it as you want. I will name it: wedding_template. We have created re-usable template with power and speed. Let's see how to use it.

Step 9 Replace images in folder created for template
Now go in folder which we have created at the beginning of tutorial. If you follow along then you have same image duplicated 9 times. You do not need that images anymore, we were using images to create template only. Select all images and delete them.

Go and find up to 10 images which you want to use. Copy and paste them in folder which is created for template (same folder from which you have deleted 10 images previously). Rename images as explained in: Step 3 rename photos. You should have up to 10 images named: wedding_01.jpg > wedding_10.jpg.
Images for template replaced and renamed

Step 10 Use template with new images
Now lets try our template. Open previously created template (wedding_template.psd if you follow along). Go to Image > Apply Data Set... Check Preview (click inside square to appear checkmark). Start clicking on Data Set 2, Data Set 3 and watch miracle (smile). You got it? Of course you did. If you have only 5 images in folder then you will see error message if you click on Data Set 6, 7...10. Do not worry, everything is ok, you just do not have images for Data Sets and that's all. After previewing all Data Sets click on Cancel button to exit, We are going to export or save all previewed compositions.
Apply Data Set

Step 11 Export Data Sets
At this point, while previewing Data Sets, you can click the Apply button and images for that particular data set will be placed. Usually you will want to save all data sets or same layout with different images. Go to File > Export > Data Sets as Files... In the Export Data Sets as Files, click on the Select Folder button and navigate to the folder where you want to save files. Leave everything else as it is: Data Sets: All Data Sets and the rest as you see on the screenshot below. Click on the OK button and Photoshop will start doing its magic.
Export Data Sets as Files

If you have only 6 images, but 10 Data Sets as I do in this case, then you do not have images for all data sets and Photoshop will display an info dialog with: Could not export "Data Set x"... Click No, because you do not have images for the rest of Data Sets and there is no reason to wait for more info dialog's.
Could not export data set

Step 12 Check export folder
Hopefully we have done something. Go and check the files you have exported. Check folder specified in Export Data Sets as Files dialog. Everything in place? WOW! Great isn't it? Here is solution how to remove sequence number and empty spaces from the file name.

You can do the exact same thing with 10.000 Data Sets and 10.000 different images. Two images are not limitation, in fact, there isn't any limitation. In fact, we haven't used all power of Data Sets, there are more options which can be used, but for an easy way title I think this is enough.
Data Sets exported

Step 13 Check what you have learned and hint
Now go and check what you have learned. Replace images (step 9) in a folder created for template images (Wedding Composition if you follow along) with some other images then repeat steps 10-12.
Data Sets for two clients

Here is one hint: if you are going to always export Data Sets in the same folder, then type for example client2 (name of client) in the first row in Export Data Sets as File dialog to not overwrite existing exported files. Just click to select Document Name and retype it.
Retype Document Name

Substitution for Smart Object layers

You can not define Variable for a Smart Object layer. Is there solution if you want to apply some distortions or transformations? Of course, you can combine Variables and actions. Simple actions can be used with Image Processor Pro to delete hidden layers, for example (we haven't worked with Visibility variables yet) or to rotate layer, distort it and so on.

To be continued…

In some of the next tutorials I will provide you with more information and files which can save you tons of time and help you to create flexible Data Sets which you can use over and over again. Some sample files you can download from here.

Conclusion

Everything works fine? Great! If not, do not hesitate to leave comments (although Google will not notify me, I will check anyway) or even better to contact me with your questions or suggestions. I did my best to explain to you how things work, but that may not be enough good or something is missing in this tutorial? I can add more information in this tutorial if needed. If I do not make at least 50 of you to play with Photoshop better of what and how I am playing, then I will count that I did almost nothing with all that tutorials and effort on this blog.

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

Reference:
Photoshop Help / Creating data-driven graphics

Comments

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