Automating Repetitive Work

Advanced Compositing & Retouching

Chapter 6 · Automating Repetitive Work

Every technique so far in this course — building a channel-based mask, setting up frequency separation's two layers, matching color across a composite — involves a repeatable sequence of steps. Once a sequence is proven to work, doing it by hand every single time wastes effort. This chapter covers how Photoshop and GIMP each let you automate that repetition — and unlike every prior chapter's difference, this one is a genuinely different paradigm, not just a different menu layout for the same idea.

Photoshop's Actions Panel: Recorded Playback

An Action is a recording. Open the Actions panel, hit record, then perform a sequence of steps normally — convert a layer to a Smart Object, apply a filter, flatten, save — and Photoshop records each step as you go. Stop recording, and that exact sequence can be replayed on any other file with a single click, or bound to a function-key shortcut for instant reuse. Actions can include a manual "stop," pausing playback so you can perform one non-automatable step (like judging a crop by eye) before the rest of the recording continues. No programming is involved at any point — you're teaching Photoshop by demonstration, not by writing instructions.

GIMP's Script-Fu: A Real Programming Language

Script-Fu is not a recorder, and this is the genuine paradigm difference worth being precise about: it's a console and interpreter for Scheme, a dialect of Lisp, built directly into GIMP. Rather than performing steps once and having them recorded, you write actual code that calls GIMP's own internal function library — its Procedure Database (PDB) — directly by name, with real variables, loops, and conditionals available exactly as they would be in any other programming language.

; Load an image, flatten it, and refresh the display (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "photo.png" "photo.png"))) (drawable (car (gimp-image-get-active-drawable image)))) (gimp-image-flatten image) (gimp-displays-flush))

Every operation is an explicit function call, wrapped in parentheses, with the function name coming first (prefix notation) — (gimp-image-flatten image) means "call gimp-image-flatten, passing image as its argument," not "image dot flatten" the way many other languages would phrase it. This syntax is genuinely unfamiliar to most people coming from any mainstream language, and that unfamiliarity is real, not a minor cosmetic difference.

Why This Difference Matters in Practice

An Action requires zero programming knowledge — anyone who can perform the steps once can create one. Script-Fu requires learning an unfamiliar syntax and genuine programming concepts (variables, conditionals, function calls) before writing anything useful at all. But that investment buys real capability an Action structurally cannot offer: a Script-Fu script can make a decision — "if this image is wider than it is tall, do X; otherwise do Y" — using an actual conditional, while an Action can only ever replay the exact fixed sequence it recorded, with no ability to branch based on what it encounters.

AspectPhotoshop ActionsGIMP Script-Fu
How it's createdRecorded by performing steps onceWritten as code, calling PDB functions directly
Underlying paradigmMacro playbackReal programming language (Scheme)
Conditional logicNot supported — replays a fixed sequenceFull support — real if/else conditionals
Learning curveNone — demonstrate once, doneReal — unfamiliar prefix-notation syntax
Manual pause mid-sequenceYes, via a StopPossible, but must be coded explicitly
Use the Script-Fu Console to experiment before saving a script
GIMP's Script-Fu Console (Filters > Script-Fu > Console) evaluates one expression at a time and immediately shows its result — a far friendlier way to learn Scheme's nested-parentheses syntax than writing a full script blind and debugging it only after running the whole thing. Test each PDB function call individually in the console first, confirm it does what you expect, then assemble the working pieces into a saved script afterward.
An Action can only replay exactly what it recorded
Because an Action has no real conditional logic, it can behave oddly or fail silently on a file that doesn't match the exact conditions present when it was recorded — a step that assumed a specific starting layer name, image mode, or canvas size can break quietly on a file that differs in some way that wasn't anticipated. This is a genuine structural limitation of recording-based automation, not a minor edge case, and it's exactly the gap Chapter 7's batch processing work has to account for when running either Actions or scripts unattended across many files with real, imperfect variation between them.

Hands-On Exercises

Exercise 1

A colleague says "Script-Fu is just GIMP's version of a Photoshop Action, with a different-looking interface." Explain why this understates the actual difference between the two.

📄 View solution
Exercise 2

Explain what (gimp-image-flatten image) means in terms of ordinary function-call syntax, and why this notation style is called "prefix notation."

📄 View solution
Exercise 3

A recorded Photoshop Action was created using a file where the background layer was named "Background," and it now fails silently on a batch of new files where that layer happens to be named something else. Using this chapter's own warning box, explain why this happened and how a Script-Fu script could have avoided the problem.

📄 View solution

Chapter 6 Quick Reference

  • Photoshop Actions — recorded macro playback; no programming knowledge required; replays a fixed sequence exactly
  • GIMP Script-Fu — a real Scheme (Lisp) interpreter built into GIMP, calling functions from GIMP's Procedure Database (PDB) directly
  • Script-Fu uses prefix notation(function arg1 arg2) — genuinely unfamiliar syntax to most newcomers
  • Only Script-Fu supports real conditional logic — an Action can't branch based on what it encounters
  • Test Script-Fu code interactively in the Script-Fu Console before saving a full script
  • An Action's fixed-sequence replay is a real limitation — it can fail silently on files that don't match its recorded assumptions