This shows you the differences between two versions of the page.
Last revision Both sides next revision | |||
cs:scripting_gimp [2020/09/01 02:42] paolo_bolzoni Created |
cs:scripting_gimp [2020/09/01 07:05] paolo_bolzoni |
||
---|---|---|---|
Line 13: | Line 13: | ||
===== Intro ===== | ===== Intro ===== | ||
- | The main obstacle is the Gimp scripts are meant to be called //from inside// Gimp. In the normal python2 interpreter the call ''from gimpfu import *'' will normally fail. | + | The main obstacle is that Gimp scripts are meant to be called //from inside// Gimp. In the normal python2 interpreter the call ''from gimpfu import *'' will fail. |
To make Gimp load our script we need to embed a bit of python code in the command line. | To make Gimp load our script we need to embed a bit of python code in the command line. | ||
Line 22: | Line 22: | ||
* ''-idf'' starts Gimp with no GUI (''-i'') and skips loading "data" (brushes, patterns, ...) and fonts (''-df''), | * ''-idf'' starts Gimp with no GUI (''-i'') and skips loading "data" (brushes, patterns, ...) and fonts (''-df''), | ||
- | * ''--batch-interpreter python-fu-eval'' tells Gimp that we want to script in Python2 (Gimp3 will use python3, but for now...), | + | * ''--batch-interpreter python-fu-eval'' tells Gimp that we want to script in python2 (Gimp3 will use python3, but for now...), |
* ''-b'' execute the script in quotes. | * ''-b'' execute the script in quotes. | ||
Line 29: | Line 29: | ||
==== What functions should I call? ==== | ==== What functions should I call? ==== | ||
- | In Gimp is the documentation of all the functions you can use. The documentation is in the **Help**->**Procedure browser**. Usually the functions are called in quite straightforward manner; seek for the name you find in the menus or the name of the menus themselves. For example, if you want the artistic filter "cubism", searching for cubism gives ''plug-in-cubism''. | + | In Gimp is the documentation of all the functions one can use. The documentation is in the **Help**->**Procedure browser**. Usually the functions are named in a quite straightforward manner; seek for the name you find in the menus or the name of the menus themselves. For example, if you want the artistic filter "cubism", searching for cubism gives ''plug-in-cubism''. |
To call the procedures one need to know that, in python2, the functions are under the object ''pdb'' (procedures database), the hyphens in the name are replaced with underscores, and the parameter ''run-mode'' has to be skipped for it is implicit. | To call the procedures one need to know that, in python2, the functions are under the object ''pdb'' (procedures database), the hyphens in the name are replaced with underscores, and the parameter ''run-mode'' has to be skipped for it is implicit. |