Using Inkscape effects wisely

Luciano Lourenco, Free Art License, wiki.softwarelivre.org/InkscapeBrasil/Imagem108

Luciano Lourenco, Free Art License, wiki.softwarelivre.org/InkscapeBrasil/Imagem108

Inking It In

Besides basic drawing functions, Inkscape provides sophisticated effects that can transform vector lines into soft, flowing brushstrokes or automate the drawing of paper-fine lines.

Inkscape is known as a drawing program, because image elements in an Inkscape document depend on lines (called vectors ) and not colored pixels like you use in bitmap programs. Its sometime association with randomly scattered sketches doesn't do the program with all its many effects full justice.

In its current version 0.48, Inkscape [1] can create images that are more like hand-painted watercolors than pencil drawings. However, these images are still based solely on lossless, scalable vector shapes (Figure 1).

Figure 1: The Inkscape drawing looks like a bitmap, but it's based exclusively on resolution-independent and Inkscape curve-tool editable vector curves.

This article will deal primarily with basic shapes and Bézier curves, which use control points to form basic shapes. Their smooth transitions and intuitive handling make them the digital equivalent of the French curve tool used by draftsmen. Since my previous Inkscape article appeared in our sister publication Linux Magazine [2] in 2005, nothing much has changed from Inkscape's solid base.

Lens Adapters

From the outset, Inkscape was capable of drawing complex shapes. But, because the program makes use of simple color fills and gradients, its graphics have tended to look like cartoons. From Inkscape 0.45 (February 2007), however, so-called filters (from the Filters menu) have added more depth and a little pizzazz.

These filters act like true camera filters that are attached to lenses that distort and colorize the object. As in photography, many filters can be layered. The effects can be undone independently of the usual undo list, making experimentation a pleasure.

Inkscape 0.48 has about 220 such filters that divide the program into 18 fairly intuitively named categories (from the Filter Effects menu). Figures 2 through Figure 4 show three typical examples from each of the categories, showing more clearly what's hidden behind each filter name. The images shown are based on a photo, whereas other filters apply to vector objects.

Figure 2: The ABCs filter category collects the most basic effects; Protrusions attach themselves to edges; Textures cover the entire object; Non-Realistic 3D Shaders handle cartoon-like, non-realistic 3D effects; Overlays only partially overlay objects; and the Blurs category is self-explanatory.
Figure 3: The Ridges filter provides a 3D profile with edge enhancement; Distort effects distort the object; Materials change the form and surface texture to various materials; Bevels form beveled materials; Morphology emphasizes the image outline; and Image Effects include typical bitmap effects much like those in GIMP.
Figure 4: Bumps handle surface grain; Shadows and Glows provide glow and lighting effects; Scatter creates tiny fragments; the three groups on the right (Image Effects, Transparent; Color; and Transparency Utilities) are for bitmaps.

In principle, all filter effects can be applied to the bitmaps embedded in each image as well as to the usual drawing elements. Many, however, are especially conceived for bitmaps, and they all have a striking impact on vector elements with their many details and colors.

Despite their number and variety, the Inkscape filters don't come close visually to the Live Effects in Adobe's Illustrator. The market leadership is not easy to take away from the commercial maker and its expensive program. A major limitation of Inkscape's effects lies in their missing settings. Filter dialogs often don't let you control the overall strength of the effect.

Primitivism

As a kind of compensation for the lack of settings, Filters | Filter Editor provides an editor that exposes the basic SVG filters individually that become the common filters applied to objects (Table 1). Figure 5 shows the basic components ("filter primitives") of the Bumps | Tinfoil preset filter. The first primitive is Gaussian blur (call-out 1 in the figure) that you can control with horizontal and vertical sliders at the bottom (call-out 2).

Figure 5: The Filter Editor, with which you can control the SVG base filters for effects, lets you fine-tune the filter after it's applied or create new effects.

Table 1

Base Effects in Inkscape

Specular Lighting Spotlighting (pseudo-3D)
Image Renders external graphics
Diffuse Lighting Background lighting (pseudo-3D)
Color Matrix Matrix-based color transformation
Flood Single Color background, mostly used with Composite
Gaussian Blur Standard blur filter
Composite Overlapping, hiding, color combining
Convolve Matrix Uses neighboring pixels to modify colors
Merge Layers one image on top of another
Morphology Flattens or thins an object
Turbulence Creates artificial textures and surfaces
Offset Simple object shifting
Displacement Map Distorts a bitmap using another as input
Blend Mixes brightness and color values

Every filter in the effect pipeline has one or more inputs from which it draws the image data. The black lines to the right of the filter list demonstrate this (call-out 3). Typically, the first filter is associated with the Source Graphic , with all others deriving input from the preceding filter. However, you can go back to earlier steps or the unchanged source graphic.

You change an input source by dragging the little triangle next to the filter name either to a preceding filter or over to the right to one of the gray columns. Source Graphic represents the entire object, including its outline, to which the effect is applied.

Alternatively, you can choose the fill or stroke color, the background of the filtered object, and the transparency value of the object or its background as input. You can drag a filter to rearrange its order in the list. Add new filter primitives by selecting them from the drop-down menu underneath the filter list (call-out 4).

Unfortunately, the result of many SVG filters is not as easy to discern as the Gaussian blur . An Offset primitive, for example, shifts the pixels of the first input based on the strength of the brightness value of the second input. Combined with a luminance primitive, this filter forms a kind of spatial pattern. Scattering and swirling effects can also be applied.

The "Base Effects in Inkscape" lists all 14 of the filter primitives in Inkscape 0.48 with a short description based on the Inkscape handbook [3], which goes into greater detail.

Long Pipeline

The Filter Editor always includes the components of all the previously applied filters. If, for example, after applying the Bumps | Tinfoil filter, you also apply Shadows and Glows | Drop Shadow , the list of primitives grows by five entries. However, it's not apparent which filter primitives belong to Tinfoil and which belong to Drop Shadows . This complicates manual fine-tuning of what are already many combined primitives.

Each entry in the list of filters on the left of the editor window (call-out 5 in Figure 5) identifies a primitive filter combination used in the document. Their names can be odd: The most recent entry is based simply on an internal counter, whereas the others carry only the name of the last filter applied. Obviously, the combination of the first programmed base effect editor and the many base-effect bundled Filters didn't quite succeed.

You can change the name of the effect bundle with a double-click. A check mark indicates the currently activated filter. If you start the Filter Editor for an object to which no filters were applied, you can assign it one of the existing combination primitives by clicking the check box. It doesn't matter whether you assemble them using the presets from the Filters menu or with Add Effect (call-out 5).

The Filter Editor is thus useful both for subsequently assembling filters from the many filter primitives and creating your own combinations of effects. Other graphics programs don't have a tool of that kind.

You'll need a lot of practice before you can somewhat predict the combined effect of many complex filters. You should therefore experiment with the individual primitives separately at the beginning. In any case, you'll learn to appreciate how much effort and skill goes into the 220 filter presets that Inkscape provides.

Unfortunately, Inkscape takes a while to display a filter's application, mainly because the program gets stuck in many processes even at the Gaussian blur stage. The process becomes irritating when doing something as simple as dragging a selection rectangle redraws the image.

The currently too unstable developer version [4] does promise some improvements. The kernel changes are apparently taking up so much of the developer resources that major feature enhancements as in version 0.48 don't seem to be evident. However, because working with the faster renderer gets things done faster, the situation is understandable.

In stable version 0.48, it's often best to switch to display mode without effects using Ctrl+5. While working with Edit | Make a Bitmap Copy , it's also useful to create a rendered snapshot while hiding the actual object; you can do this by right-clicking Object Properties | Hide . Be sure not to set the File | Inkscape Preferences value for Resolution of Bitmap Copies too high, or the conversion can take several minutes.

Bending and Scribbling

Graphics created with older Inkscape versions often seemed simple and artless, because you had to set a control point on Bézier curves for each bend.

Frequent natural occurrences, like rough paper edges or the outline of bark or tree branches, couldn't easily be drawn in that manner. Fortunately, the graphic program's current version, apart from filters, provides numerous path effects that can be rendered into complex curves using your mouse and a few clicks.

The path effects are spread across two menu locations. Path | Path Effect Editor provides a series of Live Path Effects (LPEs; Figure 6). As with Filters, you can undo LPEs independently of the usual undo list, so you can easily revert to the object's original form. Additionally, the effect parameters can be altered and transferred to other objects with Path | Paste Path Effect .

Figure 6: Live Path Effects can be grafted onto existing paths and easily removed or changed. Unlike filters, they're not made for color filling but rather for edge determination.

The same does not apply to the script effects under Extensions | Modify Path , Extensions | Generate from Path , and Extensions | Render (Figure 7). Both types of path effects operate on paths only, as they're created with the help from the curve tool.

Figure 7: The 150 extensions include those for modifying paths or drawing patterns and graphs. Unlike the 13 LPEs, extensions are mostly destructive operations that can not be reverted to their original form after carrying out further drawing operations.

You can convert basic shapes like rectangles, ellipses, spirals, and even text with Path | Object to Path . The base object, however, gets lost in the process. That's why, especially with text, making a duplicate (right-click Object Properties | Hide ) is recommended. If you want the object again, click Object | Unhide All .

All objects colored in yellow in Figures 6 and 7 are based on the simple square at the upper left. The Bend effect bends an existing object using a control path that's created with the Node Tool . Envelope Deformation has four such control paths that work independently on each of the four sides of the rectangle. For complex paths, these functions ensure that you can make subtle adjustments to a basic motif with little effort.

You can get interesting results with Stitch Sub-Paths and Interpolate Sub-Paths . These path effects make it easy to create the cross-hatching and hair that are well-known to ink drawing, as the Inkscape documentation explains [5]. The Hatches (Rough) effect does not create carefully drawn lines but rather freehand scribbled ones.

Even More Effects

The two extensions Extensions | Modify Path | Fractalize and Extensions | Modify Path | Jitter Nodes can create complex, jagged lines without a problem. Because they act on existing nodes only, the process wasn't as easy as converting the rectangle to a path for the effects in the upper left of Figure 7.

It was first necessary to use Extensions | Modify Path | Add Nodes to split the edges into many subsegments. Their number created the base for the intricacy of both effects.

The Extensions | Render function creates new paths instead of modifying existing ones. The L-System (Fractal-Lindenmayer) rendering creates some natural-looking shrubs, trees, and other patterns based on a fractals [7]. With Extensions | Generate from Path | Pattern Along Path , you can add leaves to the tree.

The Extensions | Generate from Path | Interpolate effect provides neat results by segueing the form and color of one path into another. Extensions | Generate from Path | Voronoi creates semi-random cell growth diagrams that resemble structures you find in nature.

Extensions | Render includes extensions such as wireframes and grids for geometric shapes, as well as a Function Plotter . The Inkscape manual provides details on the many other extension functions [8].

Conclusion

The 220 Inkscape filters give simple drawing objects a distinguished and often artistic look. In many cases, they can create the illusion of depth without the user having to grapple with 3D coordinates.

Because the filter effects are based on the published SVG specification [9], every modern browser (read: except Internet Explorer) can show them without first converting them to bitmaps. Another interesting addition is that Inkscape now has 13 Live Path Effects and about 150 Extensions for automatically drawing complicated forms. Thus, you can do your part in transforming simple drawings into works of art.