GIMP Usage

From Elvanör's Technical Wiki
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.
  • Saving in PNG format from within a Python script has a risk of croping the image to the layer boundary. To avoid this, just resize the layer to the image first like this:
pdb.gimp_layer_resize_to_image_size(finalLayer)
  • Saving in XCF format (or any other format) loses all your history / undo information, so be careful.

Exporting for the Web

  • Firefox and other browsers apply overlays (a block with a color and an opacity) in a way incompatible with Gimp. The solution is to make sure in Gimp that there are no partially transparent pixels (eg, all the alphas are set to 100%). Else it can lead to subtle differences that will be visible.

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.
  • Showing grids (and activating "Snap to Grid") will greatly help with the creation of rectangles, exact circles, etc. If you want to create a shape, the best is to save a temporary selection to a path, then add or remove new selections to this path.
  • There is a shortcut for clearing the selection, which can be very handy.

Selections as masks

  • In Gimp, a selection does not contain selected pixels and unselected ones. Pixels can be partially selected; usually most selection tools will create antialiased selections. This effects operations such as the paint tool and so on. It is best to think of the selection as a mask with multiple possible values. It's not a binary mask.
  • To get a "binary selection", use Selection->Sharpen command.

Gradients

  • One useful gradient is the FG to Transparent one. With it you can create glossy effects easily (picking white as foreground color).

Colors

  • Some color operations (like color balance) won't work on desaturated components (black or white parts of the layer).

Layers

General

  • To copy a layer from an image to another one, you can drag and drop it from the old image to the new one. You can also do a copy and paste (but then you need to anchor the new selection that you just pasted - this will create a new layer).
  • You can obtain a layer offset with the attribute myLayer.offsets (which is a Python tuple). You can move the layer by setting the offset with the set_offsets method.
  • An layer with the overlay type will modify the color of other layers beneath. Usually for the effect to work you must have a white background or layer below. One solution if you need a transparent background is to just duplicate the elements for which you need the overlay effect applied, and paint the copy in white (keeping alpha values intact).

Text Layers

  • You can obtain the size of a text layer bounding box programmatically by calling gimp-text-get-extents-fontname. This won't actually create the layer.

Layer Masks

  • Layer masks represent the opacity of the layer. Layer masks have their color values coded in gray tones (256 I think). White means full opacity, black means deletion (full transparency). Using layer masks you can for example easily create a fading effect. Just create a layer mask (initialized to white), paint in black the area you want to remove, and use a gaussian blur to make a smooth transition.
  • One common effect is to select all the image, shrink it by a certain amount, invert the selection and then paint the selection in black before blurring it.

Tools

  • The bucket fill tool, called via the PDB interface, does not seem to work without a selection, so make a selection first. If it is a newly created layer that you want to fill entirely, it is better to use:
pdb.gimp_drawable_fill(layer, FOREGROUND_FILL)
  • There is an align tool that allows you to precisely move objects (enter their positions with numerical values). Unfortunately, the units are always in pixels which can be troublesome.

GIMP Scripting