Skip to content
Tutorials Center
My learning

Topics

Lesson 29 of 37 ยท Automation and Export

Batch Processing, Droplets and Scripting

Run actions on whole folders with Batch, Droplets and the Image Processor, name files with templates, and learn what Photoshop JavaScript scripts can do.

An action handles one image. Batch, Droplets and the Image Processor apply it to many. When you need decisions, loops or file names built from data, you write a script.

Batch

Choose File > Automate > Batch. The dialog has four groups of settings:

  • Play: choose the set and the action to run.
  • Source: a Folder (with a Choose button), Import (from a camera or scanner), Opened Files, or Bridge. Tick Include All Subfolders to go into subfolders, Override Action "Open" Commands to ignore the Open steps recorded in the action, and Suppress File Open Options Dialogs and Suppress Color Profile Warnings to avoid pauses.
  • Destination: None leaves files open, Save and Close overwrites the originals, and Folder saves copies in a new folder (the safest choice). Tick Override Action "Save As" Commands so the batch uses this destination, not the path recorded in the action.
  • File Naming: build names from elements like Document Name, Serial Number, Date and Extension. Add a start serial number and choose compatibility for Windows, macOS and Unix.

Errors can be set to Stop For Errors or Log Errors To File, a text file that lists every file with a problem. Use the log when processing hundreds of files overnight.

Tip: Always point the destination to a different folder from the source, and run the batch on a copy of 5 images first.

File naming templates

The naming boxes compose a new name by joining elements. A name such as vacation_001.jpg could be built from a fixed text, a three-digit serial number and an extension.

Python Stand-in: build file names from a template

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Droplets

A droplet is a small application that contains an action and its batch settings. Create one with File > Automate > Create Droplet. You choose where to save the droplet, the action, the destination and the naming, just as in Batch. Afterwards, drag files or folders onto the droplet icon and Photoshop starts, runs the action and saves the results.

Droplets are good for people who do not use Photoshop's menus (a colleague who needs "resize and watermark" for product photos), and for putting a conversion on your desktop. Droplets run on the computer where they were made, since they need Photoshop installed and the action available.

Image Processor

File > Scripts > Image Processor is the fastest way to convert a folder. It does not need an action. The dialog has four steps:

  1. Choose the images to process (open files, or a folder).
  2. Choose where to save (same location or a new folder).
  3. Choose file types: JPEG (with a quality and a Resize to Fit width and height, and optionally Convert Profile to sRGB), PSD (with Maximize Compatibility) and TIFF (with LZW). You can create all of them in one run.
  4. Optionally Run Action (choose one) and add a copyright text or Include ICC Profile.

For a quick "resize everything to fit 1920 x 1080 and save as JPG quality 8", this is quicker than recording anything.

The key idea behind Resize to Fit is that the image keeps its proportions and fits inside the box. Here is the same calculation:

Python Stand-in: resize to fit a box

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Scripting

Photoshop can be controlled by scripts. The classic format is ExtendScript (files ending in .jsx, a JavaScript variant) which also runs in older versions; newer Photoshop versions also support UXP scripts (.psjs) and plugins that use the modern JavaScript engine. Platform-specific options exist too, such as AppleScript and VBScript.

Run a script with File > Scripts > Browse. Scripts placed in the Photoshop Presets > Scripts folder appear in the File > Scripts menu after a restart.

A script talks to the application through an object model. The top object is app; app.documents lists the open documents, app.activeDocument is the one you see, and each document has layers, width, height and resolution. A typical ExtendScript, which you could run by choosing File > Scripts > Browse, looks like this (read-only; do not paste it into a browser):

JavaScript
// ExtendScript (.jsx): runs inside Photoshop only
var doc = app.activeDocument;
for (var i = 0; i < doc.layers.length; i++) {
  var layer = doc.layers[i];
  if (layer.name.indexOf("copy") !== -1) {
    layer.visible = false;
  }
}

The script hides all top-level layers whose name contains "copy". The advantage over an action is logic: loops, conditions, string handling and reading files.

You cannot run Photoshop scripts here, but the idea is plain JavaScript over an object tree. This runnable stand-in models a tiny document and applies the same rule:

JS Stand-in: a script walking a document's layers

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Other automation tools

  • File > Scripts > Export Layers to Files saves every layer as its own image file.
  • File > Automate > Contact Sheet II (in some versions this plugin is optional), PDF Presentation, Photomerge, Merge to HDR Pro, Conditional Mode Change and Fit Image automate common tasks.
  • Variables and Data Sets: define text or image layers as variables (Image > Variables > Define), import a CSV with Data Sets, then export them all with File > Export > Data Sets as Files. Perfect for certificates, name badges and banners that differ only by a name or number.
  • Generator and Generate Image Assets (in the next lesson) export slices as you design.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which Batch destination setting is the safest for your originals?

    Saving to a different folder leaves the source files untouched. Save and Close overwrites them.
  2. 2. What is a droplet?

    Droplets bundle an action and batch settings in an app you can drag files onto.
  3. 3. Which tool converts a folder to resized JPGs without a recorded action?

    File > Scripts > Image Processor resizes and saves folders as JPEG, PSD and TIFF directly.
  4. 4. When would a script be better than an action?

    Scripts can repeat, decide and read data, which actions cannot do easily.

Summary

  • Batch applies an action to a folder; send output to a different folder.
  • Droplets are drag-and-drop versions of an action; Image Processor handles quick conversions.
  • Scripts (.jsx and UXP) use the app/document/layer object model for loops and conditions.
  • Variables and Data Sets produce many variations of one template from a data file.

Next: Exporting for Screens and the Web