F.1 GIMP Batch Mode

The command line is used for typing textual commands and gives users full access to all the capabilities of their operating system. Many graphical interfaces are complicated ways to access simple textual commands. To use the command line, you open a terminal window in which you type commands. A terminal is a text-only window in a graphical interface. Type a command, and after you press , you get results or answers. Some commands are interactive and ask questions and display answers. Others simply execute what you ask.

The capabilities of the command line have a lot to do with the shell, the interactive program that opens a terminal window in which you type commands in GNU/Linux. The shell accepts a command language with many capabilities. Certain shell commands can be used to apply the same process to several files (in our case, image files), including a command to call another command over and over, on all the files in a folder, or on a subset of files using just one command with a wildcard. Wildcards are symbols that can stand in for one or more characters.

Mac OS X users enjoy exactly the same capabilities because Mac is a Unix-based system. With Windows, however, the command language is rather poor, so the usefulness of the command line is more limited than in GNU/Linux or on a Mac.

When you work with GIMP from the command line, you use options and arguments. The options specify actions or parameters. The arguments are the names of the files to which the actions are applied.

When using GIMP in batch mode from the command line, you need to specify the following options: -b for batch processing and -i for running without the user interface. The -b option needs an argument, which is the command to execute. A complete call has the following form:

gimp -i -b 'command' files

The command is written using the Script-Fu language, presented in Scheme. If you want to write a short script on the command line one line at a time, you can use the following form instead:

gimp -i -b - files
commands

and then type the script on the following lines.

You can also define a new Script-Fu function and call it from the command line. In this context, the file-glob plug-in is useful: Given an encoded pattern that specifies the files, it returns the list of filenames matching this pattern. To see an example, look at http://www.gimp.org/tutorials/Basic_Batch/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset