Sub topic 1
Why automate: actions, batches and where they fit
Photoshop offers several ways to repeat work without doing it by hand. This chapter explains what each one does and when to pick it. It also sets up the rest of the tutorial, which covers each tool in detail.
Prerequisites
This chapter assumes you can already do the following:
- Open, edit and save images in Photoshop.
- Use the Layers panel and apply common adjustments, filters and the Image Size command.
- Tell the main file formats apart: JPEG, PNG, TIFF and PSD.
The last section shows a short script. You only need basic JavaScript syntax to read it, and you can skip it without losing the thread.
The problem automation solves
Repetitive image work has a predictable shape. You have a list of steps, and you need to apply them to many files. Typical jobs include:
- Resizing a shoot of 400 photos for a website.
- Adding a watermark and a border to every product image.
- Converting a folder of TIFF files to JPEG with a consistent color profile.
- Applying the same sharpening and color correction to a set of scans.
Doing this by hand has two costs. The first is time. The second, and usually the larger one, is inconsistency. By image 150 you will have skipped a step, typed a different value or saved to the wrong folder. Automation removes both costs. The steps run the same way every time, and you only have to get them right once.
The tools at a glance
Photoshop has several automation tools, and they build on each other.
- An action is a recorded sequence of commands that Photoshop can replay on the open document. It is the basic unit of automation.
- The Batch command runs one action on every file in a folder, or on all open files. It also controls how the files are opened, saved and named.
- A droplet is a small standalone program made from an action. You drag files or folders onto its icon, and it processes them. Photoshop starts if it is not already running.
- The Image Processor is a built-in dialog that resizes files and converts them to JPEG, PSD or TIFF. It needs no action, although it can run one as an option.
- A conditional action is an action with branches. It checks a property of the document, such as orientation, and chooses what to do.
- A script is a program written in JavaScript (ExtendScript in Photoshop). It can do things that actions cannot, and it can also call actions.
The central idea is that most of these tools are wrappers around an action. Learning to build a reliable action is therefore the most valuable skill in this tutorial.
Where each tool fits
Choosing the right tool is mostly a question of what the job needs. The table gives a starting point.
| Situation | Best fit | Why |
|---|---|---|
| Repeat a few edits on the document you have open | Action | You press Play and nothing else is needed. |
| Apply the same edits to a whole folder | Batch command | It opens, runs and saves each file for you. |
| Process files regularly without opening a dialog | Droplet | You drop files on an icon. |
| Resize and convert to JPEG, PNG-free of edits | Image Processor | There is nothing to record, and one dialog does it. |
| Treat portrait and landscape images differently | Conditional action | The action checks the document and branches. |
| Choose folders, rename files or loop with custom logic | Script | Scripts have full control over files and logic. |
Two rules of thumb help:
- If the job is only "resize and save as JPEG," use the Image Processor. Recording an action for this is extra work.
- If the job involves any Photoshop edit beyond that, record an action and run it with Batch.
What an action really is
An action is a list of recorded steps stored in an action set, which is a folder of actions in the Actions panel. When you play an action, Photoshop repeats each step in order on the active document. Steps can be menu commands, tool operations such as a selection or a fill, and some panel operations.
Actions are good at work that you could do from menus with fixed settings. They are weaker when a step depends on the image itself. For example, a recorded "resize to 1600 pixels wide" works on any image. A recorded "click on the logo" does not, because the recording stores pixel positions that will not match another image. Later chapters cover this in detail, including what an action cannot record and how to make steps portable.
What a batch run does
Batch adds the file handling that an action lacks. For each file in the source, Batch does the following:
- Opens the file.
- Plays the chosen action.
- Saves or closes the file, based on your settings.
- Moves to the next file.
The action is responsible for the edits. Batch is responsible for everything around them. This split causes many common errors. A frequent one is an action that contains its own File > Save As step, with a fixed file name. Batch then also saves, and every file collides on the same name. Chapters on batch file handling and troubleshooting return to this.
When automation is not worth it
Automation has a setup cost. Recording, testing and fixing an action can take longer than editing a few images by hand. A reasonable test is:
- If you will process fewer than about ten images once, edit them by hand.
- If you will repeat the job, or the file count is large, automate.
- If every image needs individual judgment, such as retouching skin or masking hair, automation will not help. An action can apply a first pass, but you finish by hand.
Also consider failure cost. A batch that silently saves a wrong result to 400 files is worse than a slow manual job. Always test an action on copies of a few files before running it on the full set, and write results to a separate output folder so the originals stay untouched.
Common mistakes at this stage
- Recording on one image and assuming it fits all. An action records the commands and values you used. If your test image is 6000 pixels wide and a later one is 800, a step that depended on size can fail or give poor results.
- Skipping the test run. Run on three to five varied files first. Include a small one, a large one, a portrait and a landscape.
- Overwriting originals. If the Batch destination is set to "None" and the action ends with a save, you can replace source files. Choose a separate destination folder.
- Using an action for a task the Image Processor already does. This costs time without adding control.
A first look at scripting
Scripts sit at the top of the automation ladder. They can call an action by name, which lets you reuse the work you put into recording it. This is the whole script:
#target photoshop
// Run one existing action on the active document.
// The first argument is the action name, the second is the action set name.
app.doAction("Resize for Web", "My Actions");The #target photoshop line tells the script host to run the file in Photoshop. app.doAction plays the action named "Resize for Web" from the set "My Actions" on the active document. Both names must match exactly, including capitalization, or Photoshop reports an error.
A script becomes useful when it also handles the folder loop. The final chapter of this tutorial shows a script that opens each image in a folder, shrinks wide images, saves JPEG copies into a subfolder and closes the originals. You do not need it yet. The point for now is that actions and scripts are not rivals. An action holds the image edits, and a script can supply the logic that actions lack.
How the rest of the tutorial is organized
The chapters follow the order in which you will need the tools:
- First, the Actions panel and recording, which cover the basic unit.
- Then editing, inserting stops and menu items, and designing actions that work on any image.
- Then Batch, file handling, droplets and the Image Processor.
- Last, conditional actions, troubleshooting and scripting.
Exercise
You have 300 JPEG photos of different sizes. You need each one converted to a maximum width of 1200 pixels and saved as a new JPEG in a separate folder. No other edits are needed. Which tool is the simplest fit, and why? Then name one change to the job that would make you switch to an action run with Batch.
Show answer
The Image Processor is the simplest fit. It resizes to a maximum size and saves JPEG copies to a chosen folder in one dialog, and no action has to be recorded. If the job also needed edits the Image Processor does not offer, such as adding a watermark layer or applying a specific sharpening filter, you would record an action and run it with Batch.
Exercise
A colleague's batch run saved all 200 images under the same file name, so only one file remains in the output folder. Their action ends with a recorded File > Save As step, and Batch was also set to save files. Which part of the setup most likely caused the collision, and where should saving be handled?
Show answer
The recorded Save As step in the action, which contains a fixed file name, is the likely cause. Each file overwrote the previous one. Remove that step from the action and let the Batch command handle saving, where the destination folder and file naming options can build a unique name for each file.