Using ChatGPT to Write GIMP Script-Fu Scripts

By Henrick December 05, 2026 5 min read AI Image Editing
How to Use ChatGPT to Write GIMP Script-Fu Scripts

Writing Script-Fu by hand is slow, because Scheme is unfamiliar and the GIMP procedure database is enormous. A chat assistant can shortcut most of that, as long as you know what it gets wrong.

Summary
It writes the structure well and invents procedure names. Verify before you run.
  • Always state your GIMP version. Version 3 changed several signatures.
  • Ask for Python-Fu if you can. There is far more Python in its training data.
  • It will invent procedure names that do not exist. Check every one.
  • Verify with the Procedure Browser before running anything.
  • Test on three copied files, never on your originals.

What It Is Good At

  • The loop structure. Open a folder, process each file, save, close. This part it gets right consistently.
  • Translating an idea into steps. Describe the job in plain English and it produces a sensible sequence.
  • Explaining existing code. Paste a script you found and ask what each line does.
  • Debugging. Give it the exact error and the script and it usually finds the problem.
  • Converting between the two languages. Script-Fu to Python-Fu and back.

What It Gets Wrong

These are consistent, and knowing them turns a frustrating session into a productive one.

MistakeWhat it looks likeHow to catch it
Invented procedure namesA call like gimp-image-auto-enhance that sounds right and does not existSearch the Procedure Browser for every name
Wrong argument countProcedure execution failed at runtimeThe Procedure Browser lists the exact arguments
Version mismatchWorks in 2.10, errors in GIMP 3 or the reverseState your version in the prompt
Photoshop logicTalks about adjustment layers or actions, which GIMP does not haveCheck it against the Photoshop translator
Missing image cleanupGIMP runs out of memory partway through a large batchEvery loop needs gimp-image-delete at the end
Important: The invented procedure name is the important one. It will not warn you, it will not hedge, and the name will look completely plausible. Assume every procedure name needs verifying until you have checked it.

How to Prompt It

A vague request gets vague code. This template gets working code most of the time.

I am using GIMP 2.10 on Linux.

Write a Script-Fu batch script that:
- reads every .jpg file from /home/me/photos
- scales each one so the width is at most 1600 pixels, keeping the aspect ratio
- applies an unsharp mask with radius 2
- saves the result into /home/me/photos/out with the same filename
- does not modify the original files

Requirements:
- use only procedures that exist in GIMP 2.10
- flatten the image before saving
- call gimp-image-delete on every image after saving
- give me the command line to run it in batch mode

The four things that make this work:

  1. State the version and platform. Without it you get an answer for whichever version dominated its training data.
  2. List the steps as bullet points. Prose gets misread. Bullets do not.
  3. Give real paths. Placeholder paths get copied into the script and forgotten.
  4. Ask for the run command too. Otherwise you have a script and no way to run it.

Verify Before You Run

Two minutes here saves losing a folder of photographs.

  1. Open Filters, Script-Fu, Console in GIMP.
  2. Click the Browse button. That is the Procedure Browser.
  3. Search for each procedure name in the script.
  4. If a name is not there, it does not exist. Ask for a correction, naming the procedure.
  5. If it is there, check the argument list matches what the script passes.

This one habit converts most of the frustration people report with AI generated GIMP scripts into a two minute check.

Then Test Properly

Verify procedure names Copy 3 files to a test folder Run there check output Then the real folder
Never point a fresh script at a folder you care about
  1. Make a test folder with three copies of real files.
  2. Point the script at that folder.
  3. Run it and check the output carefully, not just that it produced files.
  4. Only then point it at the real folder.
  5. Always write to a different output folder than you read from.
Careful: A batch script has no undo. If it overwrites its own inputs and something is wrong, the originals are gone. Every recipe in the Script-Fu generator writes to a separate folder for exactly this reason.

Debugging With It

This is where an assistant is genuinely reliable, because the error message gives it something concrete to work with.

ErrorWhat it usually means
Error: eval: unbound variableA procedure name is wrong or does not exist in your version
Procedure execution failedWrong number of arguments, or the output folder is missing
Nothing happens, no errorThe file glob matched nothing. Check the path and extension case.
Only some files processedExtensions are case sensitive. JPG and jpg are different.
GIMP runs out of memoryMissing gimp-image-delete inside the loop

Paste the full error and the full script. Partial context produces partial answers.

When to Skip the Assistant

For common jobs, a verified recipe beats generated code every time. The Script-Fu generator has ten batch recipes that were written and checked by hand: resize a folder, convert formats, make thumbnails, watermark, sharpen, greyscale, autocrop, add borders, rotate, and export XCF to PNG.

Use the assistant for the jobs those do not cover, and for editing an existing recipe into something new.

The scripting and automation guide covers Script-Fu from the beginning, and the Python-Fu guide covers the Python side.

Start from a working recipe
Ten hand checked batch recipes with the parameters filled in for you, plus the command line to run them.
Open the tool

Common Questions

Why does the script it gives me not work?

Usually one of three things. It used a procedure name from a different GIMP version, it guessed at an argument list, or it produced Photoshop style logic that has no GIMP equivalent. Check every procedure name in the Procedure Browser.

Which GIMP version should I say I am using?

Always state it explicitly. GIMP 3 changed several procedure signatures, and a model given no version will usually answer for 2.10.

Is it better at Script-Fu or Python-Fu?

Python-Fu, generally, because there is far more Python in its training data. Script-Fu uses Scheme, which is much rarer.

Can it debug an error for me?

Yes, and this is where it is most reliable. Paste the exact error message and the script, and it usually identifies the problem quickly.

Tags: Gimp Script-Fu ai automation

Explore on GIMP.cc

Step-by-step GIMP guides for every skill level.

Resize, compress, convert, and check images online.

Answers to the most common GIMP questions.

Share this article:

Twitter / X Facebook

Related Articles