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

A Random Selection of Inkscape Tricks

20 Mar 2016

Inkscape is one of these vector graphics editors which were designed with enough flexibility in mind to let you do anything you need provided some creativity.

Inkscape may not be feature-packed like e.g. Adobe Illustrator. But it's sufficiently flexible to achieve anything you'll need. Here are some thoughts.

1 Filters and Extensions

A note for beginners, to answer a question I asked myself early on too when I started with Inkscape: what's the difference between filters and extensions?

Filters are just SVG bitmap filters. There are many presets and they can be changed with Filters → Filter Editor. Note that as soon as you apply a filter to an object, it will be bitmapped in a PDF output file even if the change isn't visible. This is why that when you want to make an object e.g. glow, you may want to duplicate it and only apply the filter to the copy below. What may seem a tad misleading, is that the Object → Fill and Stroke dialogue also lets you adjust blur to objects, which effectively acts upon a filter too. It's only special in the sense that's it's sufficiently commonly used that the Inkscape developers chose to provide a separate, more convenient control to work with it.

Extensions should be more seen as external scripts: contrary to filters, their effect cannot be adjusted/removed after they've been applied. They change the SVG the drawing is stored into. Extensions are typically Python scripts and are easy to write.

2 Non-Destructive Changes

I quite like that Inkscape provides path effects which let you change the aspect of paths in a parametrised sort of way, such that you can change the effects without loss and altogether discard them if you're really unhappy about them, getting back to your object in its pristine state.

The downside of path effects is that they're CPU intensive. I find it good practice to keep a copy of each set of objects throughout their successive changes. And since the easiest way to alleviate the CPU penalty incurred by using path effects is to turn them to paths, you may want to use copies there too.

A completely different approach involves using a version control system such as git to keep your changes non-destructive.

3 Glows and Shadows

There is a filter to drop shadows under Filters → Shadows and Glows → Drop Shadow... Unfortunately, it's rather inconvenient to use because once applied, adjusting parameters such as its offsets and blur requires understanding its inner workings.

A more convenient way to create glows and shadows is probably to just clone the object and Blur it with the Fill and Stroke dialogue. Blurring this way will cause it to create a filter on the fly and, more interestingly, set the dimensions of the filter properly – which is very important when exporting to PDF. It also seems to make alignments behave right when applied to objects and their glow/shadow. You can reliably and much more simply adjust the glow whenever you want with the Blur slider in the Fill and Stroke dialogue too.

The beauty of cloning instead of duplicating lies in the fact that changing the original object you want to cast a shadow from will automatically cause the shadow to be changed too, while retaining it's blur. However, you will lose the freedom to change the colour of the shadow.

4 Reliable Exports

For some older versions of Inkscape, the graphical export dialogues tended to hog the CPU if the drawing was complex. Thankfully, Inkscape provides non-interactive switches to e.g. export files to other formats. They are more reliable to use and relieve the system from displaying the complex scene.

inkscape --export-png ~/out.png --export-dpi=300 in.svg
inkscape --export-pdf ~/out.pdf --export-dpi=300 --export-text-to-path in.svg

You may choose to use the --export-text-to-path option (-T) to ensure that stroke is properly aligned to fill for some fonts which aren't well supported.

Some older versions of Inkscape didn't always do a good job of exporting PNGs, occasionally resulting in paths with missing segments. I haven't seen any problem with exporting PDFs and found it useful to export a PDF and then turn it into a bitmap.

5 Patterns along Paths

There's different things that you can draw along a path – e.g. text – and various ways to achieve it:

6 Increasing Thickness

A rather brutal way of adding thickness to e.g. text, but which looks good, is to duplicate it, add a stroke of the desired thickness to the copy and apply Path → Stroke to Path. The fill area will be discarded, leaving you only with the stroke path. You can then easily select it with the original object and perform a Path → Union.

7 Simulating Perspective

You can choose from the extension or path effect approach:

8 Copying Gradients

Inkscape can be dangerous when it comes to copying gradients across documents: if you copy an object involving opacities of one same colour, the node opacities in the destination document will be used. For instance, if you copy an opaque-green to transparent-green shape to another document which has a not-so-transparent-green to opaque-green shape, the imported shape will also become not-so-transparent-green to opaque-green.

The solution is to give the imported shape a slightly different colour for at least one of the nodes. I once wrote the inkgrad tool which does just that. Note that the gradient orientation is preserved, however. And copying shapes with the same gradient name is not a problem either.

9 References