Batch Processing

Advanced Compositing & Retouching

Chapter 7 · Batch Processing

Chapter 6 covered creating a Photoshop Action or a GIMP Script-Fu script capable of performing a sequence of steps automatically. This chapter covers the other half of real production automation: running that Action or script against hundreds of files unattended, with no manual per-file intervention at all — the actual task a working retoucher reaches for automation to solve in the first place.

Photoshop's Batch Command

File > Automate > Batch takes a previously-recorded Action and a source folder, and runs that Action against every file in the folder automatically. It offers options for handling anything the Action recorded that needs adapting per run — overriding "Open" and "Save" steps so files read from and write to the correct folders rather than the exact paths that happened to be open while recording, and choosing how to handle a recorded "Stop" (skip it, or still pause for each file). For the specific, extremely common case of resizing and re-saving a batch of files in a new format, Photoshop also offers a more specialized dialog — the Image Processor (File > Scripts > Image Processor) — which handles that one task directly without needing to build a custom Action first.

GIMP's Batch Mode

GIMP's batch mechanism works completely differently at a technical level: GIMP can be launched from the command line with a -b (batch) flag, passing Script-Fu code directly as a command-line argument, processing files without ever opening its normal graphical window at all. This isn't "the GUI app running against a folder" the way Photoshop's Batch command is — it's GIMP running headless, purely as a processing engine driven entirely by code.

# Run GIMP with no GUI, execute a Script-Fu expression, then quit gimp -i -b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "in.jpg" "in.jpg")))) (gimp-image-scale image 800 600) (gimp-image-flatten image) (file-jpeg-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image)) "out.jpg" "out.jpg" 0.9 0 1 1 "" 0 1 0 0))' \ -b '(gimp-quit 0)'

A real production script wraps this same logic in a loop over every file in a source folder, rather than hard-coding one filename as shown above for clarity. GIMP additionally offers Python-Fu as a second scripting language option alongside Script-Fu — the same underlying GIMP Procedure Database, but callable from ordinary Python syntax instead of Scheme's prefix notation. It's worth flagging honestly here, since Chapter 6 covered Script-Fu specifically: Python-Fu is a genuinely more approachable entry point for anyone already comfortable with Python, and many real-world GIMP batch scripts are written in it rather than Script-Fu for exactly that reason.

A Real Production Task: Resize & Watermark Hundreds of Images

A common real job: an e-commerce client provides a folder of several hundred raw product photos, each needing resizing to a consistent dimension, a semi-transparent logo watermark composited into a corner, and saving into an output folder under a consistent naming scheme — all without manually opening each file. Both tools solve this the same way in principle: build and test the sequence on one file first (resize, composite watermark layer at reduced opacity, flatten, export), then apply that proven sequence across the whole folder via Photoshop's Batch/Image Processor or a GIMP batch-mode loop.

AspectPhotoshopGIMP
MechanismBatch command runs the GUI app against a folderCommand-line batch mode runs headless, no GUI at all
Common resize/convert shortcutImage Processor (dedicated dialog)No dedicated dialog — written as a script
Scripting language optionsN/A (uses recorded Actions)Script-Fu (Scheme) or Python-Fu (Python)
Runs without a displayNo — Batch still drives the visible applicationYes — genuinely headless via -i -b
Always test on a small subset before running the full batch
Running a batch operation against ten representative files first — rather than the full folder of several hundred — catches mistakes while they're cheap to fix. A wrong resize dimension, a misplaced watermark, or an incorrect output format costs a few seconds to notice and correct on ten files; the same mistake found only after processing all several hundred means redoing all of them.
Batch processing amplifies Chapter 6's silent-failure risk
Chapter 6 named a real limitation: an Action (or a naive script) can fail silently or behave oddly on a file that doesn't match the exact conditions it was built around. Batch processing doesn't just carry that risk forward — it multiplies it, since one file out of several hundred with an unexpected property (a different color mode, an unusually-named layer, a corrupted file) can silently produce a wrong result for that one file, or in some setups halt the entire batch partway through. A production-grade batch script needs explicit error handling — checking assumptions before acting, and logging which files succeeded or failed — which is genuinely more work than the "happy path" script that only handles the expected case.

Hands-On Exercises

Exercise 1

Explain the specific mechanical difference between how Photoshop's Batch command runs an Action across a folder and how GIMP's command-line batch mode runs a script across a folder.

📄 View solution
Exercise 2

A GIMP user who already knows Python well but has never learned Scheme wants to write a batch script. Using this chapter's own material, explain what option they have, and why it's a genuinely more approachable choice for them specifically.

📄 View solution
Exercise 3

A batch script resizes and watermarks 400 product photos overnight. The next morning, three of the 400 output files are blank or wrong, with no error message anywhere. Using this chapter's own warning box, explain why this likely happened and what should have been built into the script to catch it.

📄 View solution

Chapter 7 Quick Reference

  • Photoshop: File > Automate > Batch runs a recorded Action against a folder; Image Processor is a dedicated shortcut for resize/convert jobs
  • GIMP: command-line gimp -i -b '(...)' runs headless, with no GUI at all — a genuinely different mechanism, not just a different menu
  • GIMP offers Python-Fu as an alternative to Script-Fu — same PDB, ordinary Python syntax instead of Scheme
  • Always test a batch operation on a small representative subset before running the full folder
  • Batch processing multiplies Chapter 6's silent-failure risk — production scripts need explicit error handling and logging, not just the happy-path sequence