Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

Clipping with Inkscape

15 Dec 2013

Clipping is the art of cutting an object off an image, typically to paste it into another one. Turns out vector graphics are convenient for this purpose too.

While raster image graphics editors are traditionally used for this, I recently found I like using vector graphics ones for their usability and flexibility.

1 Clipping, You Say?

Some people may call it outlining, too. It's interesting, this, as it is one of the rare words where there is no convincingly specific term to describe the technique. And on this occasion, the French have come up with a rather good one that the English couldn't match: détourage. Looking it up in Wikipedia thankfully takes you to the English translation of the article which they call clipping path. Fair enough, that's going to be clipping from now on.

2 How About Clipping with Raster Image Editors?

I've been a fervent GIMP user for the best part of 15 years, and early on already it offered a nice tool set which kept on growing even since to tackle the clipping problem. There's the Fuzzy Select Tool, the Select by Color Tool, the Scissors Select Tool, the Foreground Select Tool, the Paths Tool to use Bézier curves. Other techniques involve painting on layer masks.

I've been hearing about Adobe Photoshop offering magical tools for convincingly clipping difficult subjects e.g. involving hair in no time or effort at all. I got myself a demo version to try this out and found that the result was rather poor. This is when I decided that there's nothing for it: clipping is a tedious process which takes time, technique and a subject that's not too hard to work with.

3 Clipping with Vector Objects

Over the years, I've become increasingly familiar with vector graphics. I've learned to like them because they allow for a lot of precision and you can easily keep operations non-destructive in the sense that creating a seemingly complex image only requires to manage a limited number of nodes. As a result, you can change your mind at any point in time.

3.1 Simple Curves

Taking the example of Inkscape, the Pen lets you draw Bézier curves to define the boundaries of the subject you want to clip with only a handful of nodes. Curves are described with handles whose angles determine curves. With a raster image editor, this would have lead to a large number of pixels which might have been hard to work with to adjust the curve. True, raster image editors also provide Bézier curves. But ultimately, they result in a large number of pixels. Vector graphics editor on the other hand let you work with the Bézier curve from start to finish.

Using the Pen tool to clip simple shapes
Using the Pen tool to clip simple shapes

3.2 Complex Paths

Bézier curves aren't the answer to everything, and certainly not to a more complex path such as the one that would describe the intricate set of flowers shown on that picture. For this, Inkscape's Pencil will be better suited. Simply roughly draw the outline of the flowers and leaves. You can adjust the smoothing: the smoother the path, the fewer nodes.

Using the Pencil tool to clip more complex shapes
Using the Pencil tool to clip more complex shapes

In a way, it's akin to GIMP's Free Select Tool (the Lasso) in the sense that you freely draw the path. The difference with a raster graphics editor is that Inkscape will allow you to work with the few nodes and handles that it created.

3.3 Clipping Hair

Raster image editors such as Adobe Photoshop would encourage you to use tools which perform rather fuzzy clippings from a rough outline which you provide. They advertise those tools as miraculous but in practice I've see results to be rather unconvincing. In particular, they do tend to leave behind blocky artefacts which are particularly disturbing when it comes to hair.

Vector graphics, on the other hand, allow you to precisely single out hair or lock of hairs. Of course, it's not about drawing each hair independently, that would take too long. But it's useful to identify strands of hair which stand out to succeed in the overall effect.

  1. Use Bézier curves to roughly clip the head. You can use this step to also clip significant locks of hair:

    Bézier curves to outline the head and some
large locks of hair
    Bézier curves to outline the head and some large locks of hair
  2. Also use Bézier curves to draw paths which will clip single hairs which stand out. You'll find that there will be fewer of them than you think. Don't hesitate to duplicate paths rather than drawing new ones for those hairs which stand next to each other. Make sure you turn each Stroke to Path for the upcoming Union operation.

    Bézier curves to clip single hairs
    Bézier curves to clip single hairs
  3. Finally, more Bézier curves, but this time enable the Triangle in shape to clip whole locks of hair. After you've drawn a path, adjust the size of the triangle base to cover the surface of the lock of hair.

    Bézier curves to clip locks of hair
    Bézier curves to clip locks of hair
  4. Select all the paths, apply Path → Union, select the resulting path and the original image, apply Object → Clip → Set.

    The resulting clipping
    The resulting clipping

The clipping path remaining relatively simple, you may want to further improve it by bringing the nodes closer to the hair so the background isn't too visible. You may also add holes to the clipping path do add more see-through where appropriate.

This operation mustn't have taken more than ¼ hour or ½ hour. In the spirit of non-destructive operations, feel free throughout the process to duplicate objects before e.g. turning strokes to paths, uniting them and perform other operations which would otherwise lose your original objects.

4 References