GIMP Usage

From Elvanör's Technical Wiki
Revision as of 15:33, 16 December 2007 by Elvanor (talk | contribs)
Jump to navigation Jump to search

Interface

  • If you run the GIMP under KDE, start it in a new desktop: that's currently the only way I found to get all the GIMP windows to reappear when working with multiple applications.
  • All tools have simple key shortcuts that are very useful, try to remember them.

Saving

  • PNG format allows you to choose the compression level. The default maximal compression level acts strangely (artifacts on the image), so if that happens reduce the compression level to 5-6.

Selection

  • When making a selection, for example with the rectangle tool, you have to confirm it by clicking on it. Until this click, the selection is easily modifiable by using the sub-rectangles appearing
  • A selection also usually shows the layer boundaries (which is a good thing).
  • You can create a new selection based on a layer "contents" (parts that are not transparent). This is done by right-clicking on the layer and choosing "Alpha to selection".
  • If you create a anti-aliased selection, this will apply to future operations. For example, a fill on an anti aliased rectangle will not fill uniformly the rectangle with the color; the edges will get a smooth transition.

Scripting

  • Scripting the GIMP can be done easily using the Python API. You can write pure Python scripts, and you don't need to use Scheme at all.
  • In order to make your Python script accessible from within the GIMP, you need to save it in ~/.gimp-2.4/plug-ins/. You need to make it executable or GIMP won't recognize it.
  • In your script, you need to have the register() function and a main() function which can be empty, in addition to your actual function which executes what you want. Here are the arguments for the register function (with an example):
    • "generate_rounded_corners": Name of the plugin (how to call it programmatically with Script-Fu)
    • "This is a test Python plugin." : Textual description
    • "It creates and saves an image.": Other description (extended, not sure here)
    • "Elvanör": Author
    • "Jean-Noël Rivasseau": Copyright owner
    • "2007": Date
    • "_Rounded Corners...": Name of the plugin (in the GIMP menus)
    • "RGB*, GRAY*": Modes accepted (??)
    • []: Arguments to this plugin
    • []: Return values of this plugin, only useful in non interactive mode
    • generateRoundedCorners: Python callback function (essential!)
    • menu="<Image>/Filters/Render/Rounder Corners": Path in the menus
  • In the previous list, the arguments list has the following syntax:
    • PF_STRING: type of argument
    • "targetDirectory": argument name
    • "The directory in which will be saved the images": description
    • "/srv/": Default value. This is used *only* in the interface, eg. when using the plugin non interactively you must always pass the correct number of arguments.
  • The _() function that you can see used in example plug-ins is for internationalization. The "_R" in "_Rounded Corners..." is for the mnemonic, eg the key that will be associated as a shortcut in the interface.