René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Script-FU [GIMP]

Default location for scripts

Script FU scripts are searched in the folder $HOME/.gimp-2.x/scripts. On Windows, if %HOME% is not set, they're searched in %USERPROFILE%.gimp-2.x\scripts.

Batch executing a script

Under Windows:
start gimp-2.2.exe -d -i -b  "(command-1 param-1 param2...") "(gimp-quit 0)"
Usually, the last command (when batch executing a script) is (gimp-quit 0).

Options

-b: batch. Execute the set of command-n... command-n non interactively.
-i: Run without user interface.
-d: Do not load patterns, gradients, palettes or brushes. Minimizs startup time.
-f: Do not load any font. Text functionality will unavailable.

Quoting arguments

In order to pass a string, the string needs be quoted:
start gimp-2.2.exe -i -b "(command-1 \"my string to be passed to command-1\")"

Backslashes for directories

Gimp understands forward slashes in path names and translates them, so, the following is possible:
start gimp-2.2.exe -i -b "(command-1 \"c:/temp/some_file.gif\")" 

Examples

ex_01: creates a 250x250 picture all blue.
ex_02: Hello World
ex_03: Drawing a line
ex_04: Drawing a thin line
ex_05: Drawing lines with different brush spacings.
ex_06: Creating a function (draw-line) and repeatedly calling it. (Draws a star)
ex_07: Drawing a circle
ex_08: Drawing a filled circle
ex_09: Resizing images
ex_10: Resizing images and keeping the aspect ratio
ex_11: Drawing on an existing image
ex_12: Drawing a filled rectangle
ex_13: Left-right justifying text