Looking to create a 100 images that would have their appropriate numbers written on them.

Since I`ll be most likely making changes to the template in the future I figured it would be better to automate it somehow.

Is there a simple solution to this problem?


3 Answers 3


It depends how you define "simple." Photoshop has variable data functionality built in, but it's not terribly well documented and is considered an inappropriate subject for polite conversation, such as at cocktail parties or church socials. On the other hand, it's years since I used this myself, so constructing this tutorial has been a good refresher.

You'll need a comma- or tab-delimited file with a name for each variable (I'm going to use "Image" and "ImageNumber"). Here's the one I mocked for this exercise. Note that the image filenames have no path only because they are in the same folder as the data file. You can use relative or absolute paths for the filenames:

data file

You need to set up your template. Lets assume that you need two layers: the image (variable) and the number (a text layer, variable). The image layer must be an actual layer, not the background.

base photoshop templage layers

Once you have these set up, select the image layer, and under Image > Variables > Define you will get this dialog (I checked the "Pixel Replacement" checkbox, since that's what we need to use):

define image variable

Change the "Name" field to your chosen variable name ("Image") and set the "Method" to what you need. I'm choosing "Fill," which will resize the image proportionally, but you may prefer something else. Information about each method shows in the Description field when you hover on the name. Close the dialog.

We select the text layer and repeat the process, naming the text variable "ImageNumber."

define text variable

Now we have to define a Data Set, so click the "Next" button in the dialog and click the New Data Set icon (right by the trash can) in the dialog.

Data Set dialog

A Data Set is a collection of values that apply to a particular output document, not a complete set of values in a comma-delimited file, so now we define a starting image for our template by clicking the "Select File..." with the Image variable selected. I chose the Chrysanthemum image. Be sure that "Do Not Replace" is NOT selected.

image value selected

Now we have to import the data sets from our comma-delimited file using the "Import" dialog.

import dialog

Exhausted yet? -- There's more. Click OK to close the Variables dialog.

The final step is to choose File > Export > Data Sets as Files... and choose a place to save the output, along with your choice of naming convention.

export dialog

When you click OK, the entire set of psd file will be exported to your chosen location.

  • I have followed this ok to a point, but am now stuck. When I come to export my files I need each one to have the value of one of the variables associated with it. It seems to only be letting me use a limited option with a sequential number, which is no good for what I need to do. Any advice would be appreciated either using CS5 or others.
    – user27124
    Jul 12, 2014 at 14:25
  • Fantastic! You've saved me hours of work, thank you, Alan.
    – MorganR
    Jun 9, 2015 at 10:49
  • Wow, thanks man. Exactly what I needed ! Dec 30, 2019 at 19:28

Yes its possible to automate. Open Extend Script toolkit. Write

#target Photoshop
alert("Hello "+app.activeDocument.name+"!")

Save script and run it, it should now see a alert box provided that PS is open and has a document. Its just javascript you can find the reference manual:

Here is how you change text in a text layer and save it (adding the save bit because its a bit tricky):

#target Photoshop

var textlayer = app.activeDocument.layers.getByName('Text');
textlayer.textItem.contents = 'foo';

var exportOptionsSaveForWeb = new ExportOptionsSaveForWeb();
exportOptionsSaveForWeb.format = SaveDocumentType.PNG;

var saveFile = new File("file:///c:/temp/test.png");
app.activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, exportOptionsSaveForWeb);

So that i will not do all the work for you you still need to put a for loop around the code posted.

  • Copy and paste this to the existing question please
    – Ryan
    Aug 31, 2015 at 13:48

This is a solution for a problem described in Automate image creation with addition of number, that increases with each iteration

Yes, it's a bit similar, but instead of the current question witch is many -> many mine is one -> many and has a bit different and quicker solution.

Here it goes:

  1. Opened an image, added Type layer with all the styling I wanted.
  2. Then I went to

    Image > Variables > Define…
  3. Set Layer: to my text layer's name, set checkbox on Text Replacement and gave Text Replacement variable some Name: (I've named it number). And pressed OK.

  4. Opened some spreadsheet editor like Excel, Numbers, Google Docs, etc… and entered the next stuff in the first column:

    1. In first row I've written my variable's name (for me - number).
    2. In the below (the 2nd row) I've entered 1. Sometimes for step 3 to work, you need to enter 2 in a 3rd row.
    3. Now using standard spreadsheet autocomplete grab the lower right corner of a cell with 1 (or 2) in it and drag down. This way all the cells below should be filled with a sequent numbers (I've generated sequence up to 99).
    4. Ok, all you need to do now is export your spreadsheet to CSV.
  5. Now you should go to

      Image > Variables > Data Sets…

    select Import… browse your CSV file, and click OK. You can also check the Preview button to see how your image will look like with certain dataset (number). Once more click OK to save the Data Sets.

  6. Finally, to get all the files with different stuff go to

    File > Export > Data Sets as Files…

    Select destination folder, and make sure you have All Data Sets option selected, as this will generate a file for each of out data sets, just what we need. In the same window you can also choose a naming option for exported files. And click OK :)

  7. This will generate a psd files, so you'll need to convert them somehow into something simpler. This can be achieved with

    File > Scripts > Image Processor…

    This script will allow you to convert a lot of psd images into JPEG with one click of a button.

Also maybe you'll be interested in the next tutorial about Photoshop Variables: http://layersmagazine.com/photoshop-variables.html

  • 1
    Thank you for this part: "This script will allow you to convert a lot of psd images into JPEG with one click of a button." graphicdesign.stackexchange.com/a/4874/45239 plus that sentence of yours were a big help.
    – Ryan
    Jun 28, 2016 at 0:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.