Foreword

This page expounds my own understanding of Gimp paths. I may be mistaken on some points (in which case I'll gladly accept corrections).

Paths and strokes

Paths

In Gimp terms a 'path' is made of 'strokes', that are uninterrupted lines. For instance, an "0" is usually made of two strokes, one for the outer circle and one for the inner one, while an "M" is one single stroke, and an "8" will usually be three. The word "PATH", for instance, corresponds to 6 strokes in most fonts:

  • The outline of 'P'
  • The inner loop of 'P'
  • The outline of 'A'
  • The inner triangle of 'A'
  • The outline of 'T'
  • The outline of 'H'

Paths are not created equal. Paths obtained geometrically (for instance by importing an SVG, or using a script to generate geometric shapes) are likely a lot "cleaner" than those obtained from a selection, even if they look identical to a naked eye. The paths generated by some of tools in this project are even worse...

Strokes

A stroke is itself a sequence of Bezier curves. Bezier curves are fairly well described on Wikipedia. In practice Gimp uses cubic Bezier curves defined by:

  • two "control points" or "anchor points", that are the extremities of the curve,
  • two "handles" (one for each control point) that define the tangent of the curve at the control point.

The coordinates of the control points and the handles are floating point numbers, and do not have to correspond exactly to pixels.

A complete stroke is a sequence of curves, where the ending control point of a curve is the starting control point of the next. Each control point then gets two handles, one as a ending point and one as a starting point, and a complete stroke is defined by a sequence of triplets (end/backward handle, control point, start/forward handle). The control points at the extremities of the stroke do get both handles.

When a control point has no tangent defined (this happens for instance if the stroke is a polygon with straight lines segments), the corresponding handle has the same coordinates as the control point.

In Gimp, there is no "orientation" of the strokes, and some transforms can reverse a stroke without notice.

A stroke can be marked as "closed". This means that, when drawn, there is an extra Bezier curve generated from the ending point back to the starting point (this is one reason why these points have both handles). This is of course fairly theoretical if the starting and ending point have the same coordinates, as it sometimes happens with paths generated from fonts.

"Outline" fonts versus "stroke" fonts

There are two kinds of fonts: the "outline" ones and the "stroke" ones. The outline fonts are the most frequent: our systems come loaded with them. The glyphs in the font are strokes that delineate the outline of the glyph. This outline is usually filled to display the glyph. When using the Text tool on such a font and using Path from text, one obtains:

Stroke fonts (sometimes also called "engraving fonts") are much less frequent. They define the characters as very basic strokes that have no specific width. The result of Path from text on such fonts is quite different:

Such fonts have their use in Gimp, for instance to draw letters using brushes (flowers, sparks...)

These fonts are not easy to find (at least as free versions).

Gimp currently has an incorrect behavior when using these fonts: it displays these fonts by filling an outline (so, for instance, an "O" appears as a full disc), and, more annoyingly, it closes all the strokes (maybe in the hope of being able to fill the outline thus created). You'll find in the script collection an unclose-path script whose purpose is to fix the paths created from stroke fonts.