17.1 Blur

We have seen blurring used many times throughout this book. Properly called Gaussian blur (named after Carl Friedrich Gauss, a German mathematician), this effect smoothly “dissolves” the object, as if viewing it through an out-of-focus lens. Blur is only one of the 14 filter primitives that Inkscape supports—but of all these primitives, Blur has by far the most user-friendly interface: You can adjust it, for any object at any time, with a simple slider in the Fill and Stroke dialog:

The Blur slider in the Fill and Stroke dialog

Figure 17-1. The Blur slider in the Fill and Stroke dialog

One might thus say that Inkscape treats blur as a fundamental property of an object, just like its opacity. Why this special treatment? On one hand, it is because blurring an object is such a natural, basic operation. Blurring is everywhere in the physical world: Non-crisp shadows, glows, and things viewed out of focus or in motion are all renderable with blur. This filter is therefore absolutely essential if you want to draw anything photorealistic. On the other hand, blur is not something you can easily imitate with regular vector shapes or gradients. So, by adding just one easily accessible slider, Inkscape’s capabilities expand enormously.

The Blur slider controls the amount of blur in a range from 0 to 100 percent; the setting of 1 percent barely changes the appearance of an object, and 100 percent turns any object into a shapeless puff. The percentage makes sure that this scale works the same for objects of any size; in other words, a large object blurred by 10% has a larger absolute amount of blur (larger blur radius), but it looks exactly proportional to a small object that is also blurred by 10 percent. If you want to get the same blur radius in objects of different sizes, you need to use different blur amounts.

Blur amount (same in A and B) and blur radius (same in A and C)

Figure 17-2. Blur amount (same in A and B) and blur radius (same in A and C)

As you will notice, blurring an object affects its bounding box (only if the visual bounding box type is used, 4.2 The Bounding Box). The expanded bounding box will cover all of the blurred fringe of the object.

Each blurred object is processed separately, as if on its own, fully transparent layer, and thus it never “smears” any adjacent nonblurred objects. Since that per-object layer is by itself transparent, the edges of a blurred object become partially translucent. However, you can blur a group, and in that case, all members of the group are blurred together, as if placed on a single layer that is blurred as a whole. In Figure 17-3, on the left there are two adjacent rectangles with no gap between them and no blur. In the middle, each rectangle is blurred by 20 percent separately; as you can see, the striped background can be seen through the blurry gap between the objects. On the right, however, the same two rectangles are first grouped and then the group is blurred by 20 percent; now there is no gap—blurring only adds transparency at the edges, but it cannot reveal what was completely covered by the center of the opaque group.

Blurring separate objects vs. blurring a group

Figure 17-3. Blurring separate objects vs. blurring a group

Also, grouping allows you to apply several layers of blurring to the same object. For example, you can blur the object itself, then group it (possibly even just with itself, that is, placing a single object into the group) and blur the group. Naturally, by blurring a group, you can make any member objects more blurred than they were before, but not less. (Similarly, as we saw in 16.3 Styling Clones, you can blur a clone more than its original object was blurred, but not less.)

Note

Blur is not the same as feathering. Blur affects all of the object; in particular, the lines on a bitmap object or the object boundaries inside a complex group are all blurred. Feathering, on the other hand, is simply blurred transparency that masks out the outermost edges of an object (such as a photo). Inkscape can do feathering as well, using a predefined composite filter (17.3 Preset Filters).

Blurring vs. feathering

Figure 17-4. Blurring vs. feathering

What happens if you transform a blurred object?

Moving a blurred object is not very interesting: The object just moves as a whole, remaining as blurred as ever. Proportional (uniform) scaling also scales the object as a whole, including the blur radius, so that the amount of blur stays the same as it is relative to the object size (i.e., the percentage indicator in the Fill and Stroke dialog does not change).

Nonuniform scaling is more interesting. For example, if you squeeze a blurred object vertically, its blur will squeeze with it and become nonuniform—now the object is more blurred horizontally than vertically. Such nonuniform blur is sometimes called motion blur because it approximates the way the object would look on a photo when captured in fast motion (in this case, horizontal). So, if you want to apply a motion blur to the original nonsqueezed object, simply start by stretching it in the opposite direction, then blur it, and squeeze it back into shape (this only works for paths and bitmaps):

Another way to create nonuniform motion blur is by adjusting the parameters of the Gaussian Blur filter in the Filter Editor dialog (17.4 The Filter Editor Dialog), but the stretch/squeeze method described here is usually easier.

Note

If you’re interested in how this works at the SVG level, the trick is to make sure the blur is applied to an object with a transform attribute (A.7 Transformations), which assures that the blur will be affected by that transform as well. When you stretch a path object without blur, this stretching is by default embedded into the points of the path (12.5.7.3 Transforming Nodes); but once you apply the blur, reverse squeezing will instead add the transform attribute, affecting the blur as well.

To create motion blur on a group or text object (i.e., not a path or bitmap), use this trick: Stretch the object, then group it (, 4.5 Groups), apply a blur to the group, and squeeze it back. The grouping step makes sure that in the end, you get an object with the correct proportions but also with the squeezing transform attribute affecting the blur.

Similar remarks apply to the way many other filters behave when transformed. For example, squeezing and/or rotating objects allows you to create perspective-distorted variants of the texture filters (17.3 Preset Filters) for applying to walls and floors in 3D scenes (11.3 3D Boxes). Of course, transforming filters by stretching and squeezing objects is not as convenient as dragging handles on canvas would be—but it works.

The Blur mode of the Tweak tool blurs the selected objects under the brush more (by default) or less (with pressed). The amount of blur added or removed depends on Force, pen pressure (if you’re using a tablet pen), the closeness of the object to the center of brush, and how long you apply the brush.