Gimp Start Flags And rcfiles
Ordinarily, Gimp is launched by an icon or a menu in your favorite window manager, but you can also start it manually. There are several initiation files that control the behavior of Gimp.

## Gimp Command Line Switches AKA Flags (Options)
| An excellent source of information about the command line switches and environments that Gimp supports can be found in the Gimp man page. It's located in the `doc dir` in your Gimp source distribution, and normally you only have to enter the command `man gimp` after you have installed Gimp to open the man page. All of this is done in a shell, such as in an xterm or rxvt window. As we mentioned earlier, you have probably hidden all this in your Window Manager so you only have to click on an icon or open a menu. If you want to test flags and different environments or even run Gimp without Xwindow, you must do this in a shell. Typing `gimp --help` or `gimp -h` and pressing Enter will result in a short description of available flags that you can give Gimp: [`olof@olof olof]$ gimp --help` `Usage: gimp [option ...] [files ...]` `Valid options are:` `-h --help Output this help.` `-v --version Output version info.` `-b --batch <commands> Run in batch mode.` `-n --no-interface Run without a user interface.` `--no-data Do not load patterns, gradients, palettes, brushes.` `--verbose Show startup messages.` `--no-splash Do not show the startup window.` `--no-splash-image Do not add an image to the startup window.` `--no-shm Do not use shared memory between Gimp and its plug-ins.` `--no-xshm Do not use the X Shared Memory extension.` `--display <display> Use the designated X display.` `[olof@olof olof]$` The `-h` and `--help` flags obviously printed out the above message. The `-v` and `--`version flags show what version of Gimp you are running (this information is also available in the About dialog and the splash screen that shows up when you start Gimp). It will typically look like this: [olof@olof olof]$ gimp -v GIMP version 1.0 Always visit `www.gimp.org,` `ftp.gimp.org` or one of its mirrors to get the newest stable version of Gimp. ### Batch Mode And No-Interface The `-b` and `--batch` options allow you to execute Gimp with arguments to run. This is ideal if you want to execute a lot of commands to a lot of files. Otherwise, it would be quite annoying to have a GUI do all these actions (open image, apply commands, save image, open another image, apply command etc.). The `<commands>` `shown earlier` is a Script-Fu that will do the actual work for you (even if you can execute ordinary `gimp pdb` commands directly). `-n` and `--no-interface` are suitable if you run Gimp in batch mode because most of the time you don't want to have a user interface if you are running a batch. This will also save some memory and system resources. Here is an example of two batch commands: gimp -n -b '(gimp-procedural-db-dump "pdb_dump.tmp")' '(gimp-quit 0)' These will dump Gimp's pdb database to a file called `pdb_dump.tmp` in your working directory. Here is an example of a custom script that is invoked by Gimp (`my-script` is your own personal custom script): gimp -n -b '(my-script 1 "\"Sample text.\"")' '(gimp-quit 0)' The `(gimp-quit 0)` is so Gimp quits gracefully and returns the command prompt to you. If you don't have X-window up and running (i.e., you are running your UNIX session in a console that has no graphic capabilities or you have a modem connection to your UNIX host with a vt100 terminal only), then you still can run Gimp in batch mode; just do it like this: Xvfb :1 -screen 0 10x10x8 -pixdepths 1 & gimp --display :1.0 -n -b '<commandos> ' '(gimp-quit 0)' This will fire up an invisible X-server, in which you run Gimp. #### More Options As you saw above, we introduced a new flag, `--display`. Because X lets you run Gimp on one host and display it on another, you have to specify on which display to run Gimp's user interface. Normally you run and display Gimp on the same host, and you don't have to barter about display settings. Here's an example of how to use the display option in Gimp. Say that you have a "supercomputer" at your campus running UNIX, and this computer has Gimp installed. Then, it would be more than efficient to edit huge Gimp images at this computer while displaying them at your local workstation or X-terminal. Here is a quick how to. At your workstation, you will execute a command allowing the supercomputer to display Gimp on your workstation: [olof@olof olof]$ xhost niceriver.frozenriver.com (my local supercomputer ;) niceriver.frozenriver.com being added to access control list The second line enabled the supercomputer to access our X-server at our workstation. All we have to do now is to `telnet`, or `rlogin` or `rsh` to the supercomputer: [olof@olof olof]$ rlogin niceriver.frozenriver.com [olof@niceriver olof]$ Now, we are logged in to the supercomputer. All we have to is open Gimp and tell it where to display (at `olof.frozenriver.com)`, and which display to use at olof.frozenriver.com. Because we only have one display at `olof`, we will use display number 0: gimp --no-xshm --display olof.frozenriver.com:0.0 Now, Gimp will display at your workstation and you can work with it just as if you had run Gimp at your workstation. When you are finished with Gimp you just have to log out from the supercomputer and tell your workstation that you don't want the supercomputer accessing your X-server: [olof@olof olof]$ xhost - niceriver.frozenriver.com niceriver.frozenriver.com being removed from access control list The last line tells us that the supercomputer no longer can access our X-server. There are, of course, better ways to handle remote display, that have better security, automatic transfer of the display environment, etc., but that is beyond the scope of this book. We introduced another new option earlier,`--no-xshm`, which tells Gimp not to try to use X-shared memory. We have to do this because we ran Gimp on a different host. If we run Gimp on the same host that we displayed Gimp at, we can use X-shared memory to speed things up a little bit, and also to save system resources. There is another shared memory flag, `--no-shm`, which tells Gimp not to share memory with its plug-ins. It's generally good to let Gimp do this, but if you encounter problems it can be wise to turn it off. `--no-splash` tells Gimp not to show the splash when it starts. If you just tell Gimp `--no-splash-image`, then the splash will be shown, but without the image. `--`verbose will start up Gimp a little more verbosely and you will see in the shell how it's phrasing the different initialization files.. [olof@olof olof]$ gimp --verbose parsing "/home/olof/.gimp/gtkrc" parsing "/usr/local/share/gimp/gimprc" parsing "/home/olof/.gimp/gimprc" parsing "/home/olof/.gimp/pluginrc" writing "/home/olof/.gimp/pluginrc" parsing "/home/olof/.gimp/menurc" Starting extensions: extension_script_fu The last option is `--no-data`, which you can use if you run Gimp in batch mode and don't need brushes, gradients, palettes or patterns. The start-up time for Gimp will then be minimized.
## Installing A New Version Of Gimp
| If you are installing a new version of Gimp, please remember to remove your personal `rc` files, by renaming the `.gimp` directory to `.gimp.old.` Then, you can open your old files and cut and copy special file modifications.
## Initialization Files AKA rc-files
| Gimp has a lot of initializations files that control the behavior of Gimp. Most of the options that you set in different rc files are done using the Preference dialog (see Chapter 5). We will only take a look at the options that you can't set from the dialog. ### gimprc And ~/.gimp/gimprc The system-wide `gimprc` and the personal `gimprc` located in your gimp directory (usually `~/.gimp/gimprc`) control nearly all of Gimp's options. To make changes in your personal `gimprc` file (`~/.gimp/gimprc`) you have to bring it up in an editor and edit the file: `[olof@olof olof]$ xemacs ~/.gimp/gimprc` There won't be much in it, because most of the options are written in the system-wide `gimprc` file (usually `/usr/local/share/gimp/gimprc)`. If you want to change a system-wide setting, then copy it from the system-wide `rc` file, paste it into your personal `rc` and then change the setting. Because the system-wide `rc` file is phrased before the personal `rc` file, everything written in the personal file will override what's written in the system-wide file. It's a good idea to open the system-wide `rc` file to get a glimpse of what you can change. If you are a system administrator, it's wise to change the system-wide `rc` file to fit your site's needs. As you can see, the file is more or less self-explanatory, and we will only comment on things that you can't set in the Preference dialog. # This is the system-wide gimprc file. Any change made in this file # will affect all users of this system, provided that they are not # overriding the default values in their personal gimprc file. # # Lines that start with a '#' are comments. # Blank lines are ignored. # The variable gimp_dir is set to either the interned value # .gimp or the environment variable GIMP_DIRECTORY. If # the path in GIMP_DIRECTORY is relative, it is considered # relative to your home directory. (prefix "/usr/local") (exec_prefix "${prefix}") (gimp_data_dir "${prefix}/share/gimp") (gimp_plugin_dir "${exec_prefix}/lib/gimp/0.99") You shouldn't change these preferences, but if you feel you must, you can only do it in an editor. # Set the temporary storage directory...files will appear here # during the course of running the gimp. Most files will disappear # when the gimp exits, but some files are likely to remain, # such as working palette files, so it is best if this directory # not be one that is shared by other users or is cleared on machine # reboot such as /tmp. (temp-path "${gimp_dir}/tmp") # Set the swap file location. The gimp uses a tile-based memory # allocation scheme. The swap file is used to quickly and easily # swap files out to disk and back in. Be aware that the swap file # can easily get very large if the gimp is used with large images. # Also, things can get horribly slow if the swap file is created on # a directory that is mounted over NFS. For these reasons, it may # be desirable to put your swap file in "/tmp". (swap-path "${gimp_dir}") # Set the brush search path...this path will be searched for valid # brushes at startup. (brush-path "${gimp_dir}/brushes:${gimp_data_dir}/brushes") # Specify a default brush. If none is specified it Defaults to the # "1circle.gbr" brush which is just a single pixel-sized brush. # The brush is searched for in the brush path. (default-brush "19fcircle.gbr") Not adjustable in the Preferences dialog. # Set the pattern search path...this path will be searched for # valid patterns at startup. (pattern-path "${gimp_dir}/patterns:${gimp_data_dir}/patterns") # Specify a default pattern. # The pattern is searched for in the specified pattern paths. (default-pattern "wood2.pat") Not adjustable in the Preferences dialog. # Set the palette search path...this path will be searched for # valid palettes at startup. (palette-path "${gimp_dir}/palettes:${gimp_data_dir}/palettes") # Specify a default palette. # The pattern is searched for in the specified pattern paths. (default-palette "Default") Not adjustable in the Preferences dialog. # Set the gradient search path...this path will be searched for # valid gradients at startup. (gradient-path "${gimp_dir}/gradients:${gimp_data_dir}/gradients") # Specify a default gradient. # The gradient is searched for in the specified gradient paths. (default-gradient "German_flag_smooth") Not adjustable in the Preferences dialog. # Set the plug-in search path...this path will be searched for # plug-ins when the plug-in is run. (plug-in-path "${gimp_dir}/plug-ins:${gimp_dir}/plug-ins/script-fu:${gimp_plugin_dir}/plug-ins") # Set the path for the script-fu plug-in. This value is ignored by # the GIMP if the script-fu plug-in is never run. (script-fu-path "${gimp_dir}/scripts:${gimp_data_dir}/scripts") Not adjustable in the Preferences dialog. # The tile cache is used to make sure the gimp doesn't thrash # tiles between memory and disk. Setting this value higher will # cause the gimp to use less swap space, but will also cause # the gimp to use more memory. Conversely, a smaller cache size # causes the gimp to use more swap space and less memory. # Note: the gimp will still run even if `tile-cache-size' is # set to 0. The actual size can contain a suffix of 'm', 'M', # 'k', 'K', 'b' or 'B', which makes the gimp interpret the # size as being specified in megabytes, kilobytes and bytes # respectively. If no suffix is specified the size defaults to # being specified in kilobytes. (tile-cache-size 10m) # Speed of marching ants in the selection outline # this value is in milliseconds # (less time indicates faster marching) (marching-ants-speed 300) # Set the number of operations kept on the undo stack (undo-levels 5) # Set the color-cube resource for dithering on 8-bit displays # The 4 values stand for Shades of red, green, blue and grays # Multiplying the # of shades of each primary color yields # the total number of colors that will be allocated from the # gimp colormap. This number should not exceed 256. Most of the # colors remaining after the allocation of the colorcube # will be left to the system palette in an effort to reduce # colormap "flashing". (color-cube 6 6 4 24) Not adjustable in the Preferences dialog. # Install a GIMP colormap by default -- only for 8-bit displays # (install-colormap) # Specify that marching ants for selected regions will be drawn # with colormap cycling as opposed to redrawing with different # stipple masks. This color cycling option works only with 8-bit # displays (colormap-cycling) # Tools such as fuzzy-select and bucket fill find regions based on # a seed-fill algorithm. The seed fill starts at the initially # selected pixel and progresses in all directions until the # difference of pixel intensity from the original is greater than a # specified threshold ==> This value represents the default # threshold (default-threshold 15) Not adjustable in the Preferences dialog. # There is always a tradeoff between memory usage and speed. In # most cases, the GIMP opts for speed over memory. However, if # memory is a big issue, set stingy-memory-use # (stingy-memory-use) # When zooming into and out of images, this option enables the # automatic resizing of windows # (allow-resize-windows) # Context-dependent cursors are cool. They are enabled by # default. However, they require overhead that you may want to do # without. Uncomment this line to disable them. # (no-cursor-updating) # Layer preview sizes: # none: no previews in layers dialog/layer selector # small: 32x32 # medium: 64x64 # large: 128x128 # #: #x# (preview-size small) # Tooltips # Comment this out to disable the tooltips in the toolbox # (dont-show-tool-tips) # Controlling ruler visibility # The default behavior is for rulers to be ON # This can also be toggled with the View->Show Rulers command or # shift+control+r (dont-show-rulers) Not adjustable in the Preferences dialog. # Ruler units # The units of rulers can be one of: (pixels inches centimeters) # The default is pixels (ruler-units pixels) Not adjustable in the Preferences dialog. Don't change this unless you know what you are doing. # Disable auto saving # Just uncomment the line below... # (dont-auto-save) Not adjustable in the Preferences dialog. It doesn't do anything at the moment. # Disable confirmation before closing an image without saving # Just uncomment the next line # (dont-confirm-on-close) Not adjustable in the Preferences dialog. # Setting the level of interpolation # Uncommenting this line will enable cubic interpolation. # By default, GIMP uses linear interpolation, which is faster, but # has poorer quality # (cubic-interpolation) # Set the gamma correction values for the display # 1.0 corresponds to no gamma correction. For most displays, # gamma correction should be set to between 2.0 and 2.6 # Run the utility "gamma_correct" to determine appropriate values # for your display. # # One important item to keep in mind: Many images that you might # get from outside sources will in all likelihood already be # gamma-corrected. In these cases, the image will look washed-out # if the gimp has gamma-correction turned on. If you are going # to work with images of this sort, turn gamma correction off # by removing this line, or setting the values to 1.0. # gamma-correction 1.0 # gamma-correction 2.0 # ___ (gamma-correction 1.0) Not adjustable in the Preferences dialog. See Chapter 13 on how to make a gamma correction. # Set the manner in which transparency is displayed in images # Transparency type can be one of: # 0: Light Checks # 1: Mid-Tone Checks # 2: Dark Checks # 3: White Only # 4: Gray Only # 5: Black Only # Check size can be one of: # 0: Small # 1: Medium # 2: Large (transparency-type 1) (transparency-size 2) The rest of the file contains paths for different plug-ins. Quite often you have to add a line like this to specify the path to auxiliary files for some new plug-ins. These lines are not adjustable in the Preferences dialog. (fractalexplorer-path "${gimp_data_dir}/fractalexplorer:${gimp_dir}/fractalexplorer") (gfig-path "${gimp_data_dir}/gfig:${gimp_dir}/gfig") (gflare-path "${gimp_dir}/gflares:${gimp_data_dir}/gflares") ### menurc This is a personal-only file located in your `.gimp` directory. This is where all of your dynamically changed key bindings end up. The easiest way to edit this file is to do the key binding in Gimp. The altered shortcuts will be written to this file as soon as you quit Gimp. If your key bindings are beyond repair, then remove the file: [olof@olof olof]$ rm ~/.gimp/menurc There is also a key binding file that will make Gimp use Photoshop's key bindings. It's located in the system-wide directory, and it's called`ps-menurc`. If you want to use it, just copy it to your `.gimp` directory: [olof@olof olof]$ cp /usr/local/share/gimp/ps-menurc ~/.gimp/ But why use Photoshop key bindings when there are Gimp key bindings? ### pluginrc This file holds information about all the plug-ins available to Gimp. Do not edit this file! If Gimp starts having problems with plug-ins, then you can delete this file and Gimp will write a new one for you: [olof@olof olof]$ rm ~/.gimp/pluginrc ### gtkrc This file is also a personal-only file. It controls the behavior of the GTK tool kit that Gimp uses for its menus, tabs, etc. One of the few reasons to edit this file is to change the font or font size that Gimp uses in the menus. Here is an extract: # style <name> [= <name>] # { # <option> # } # # widget <widget_set> style <style_name> # widget_class <widget_class_set> style <style_name> style "ruler" { font = "-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*" } style "default" { font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*" } #style "lsystem_rules" #{ # font = "-*-courier-medium-r-normal--*-100-100-100-m-*-*-*" #} widget_class "*Ruler*" style "ruler" widget_class "*" style "default" To understand how to change the font line, please read "Text And Fonts" starting on page 165 and "How To Get Fonts To Gimp" starting on page 759. This file is otherwise quite self-explanatory.

Frozenriver Digital Design http://www.frozenriver.nu Voice: +46 (0)31 474356 Fax: +46 (0)31 493833 support@frozenriver.com | Publisher Coriolis http://www.coriolis.com