What I want to achieve is basically this:

enter image description here

a path with a gradient that goes transparent towards the sides.

What I really want, though, is that gradient to be linear. For the example above, I used a Gaussian Blur filter, which, by definition, isn't linear.

I also tried to make a small rectangle with a vertical linear gradient transparent-black-transparent and then applying it to the path, but it doesn't work, because objects cannot be put along paths, other paths can.

Any idea?

  • Why do you want to do this? Why isn't a guassian blur suitable? A gaussian blur added to a path is still editable as a vector path. See example and the result is transparent. – Billy Kerr Feb 17 at 10:40
  • I want to draw a path for a Thymio robot, it needs that specification. – SteeveDroz Feb 17 at 10:48
  • Are you going to print the gradient path? There is a new swamp of nonlinear grayscale reproduction waiting for you. – user287001 Feb 17 at 11:14
  • I am going to print it, what are you speaking about? – SteeveDroz Feb 17 at 11:17
  • Printers make grays by varying how big part of the paper is covered with opaque black ink. They can also try to layer overlapping cyan, magenta and yellow dots. In low cost home and office printers the user has very little of control over the process. You can have linear gradient onscreen but the print process can spoil it "for your best". Illustrator and Affinity Designer at least allow you to make arbitary gradients along a path. You can experiment which gradient is linear enough as printed. Rasterized gradient causes no extra harm because normal printers rasterize it in the printer driver. – user287001 Feb 17 at 11:30

I guess blurring is a hopeless way to make trackable gradients for your robot experiments. You need something like this:

enter image description here

This is drawn with pattern brush which has a linear 3-stop gradient white-black-white. The screenshot is from Affinity Designer which allows any PNG image to be used as a brush. The curve can be an arbitary path, you only apply the brush to it.

This functionality is available at least in Illustrator and Affinity Designer. Inkscape hasn't it.

In Inkscape you can try to apply Extension > Generate from path > Interpolate. In the next image it's applied to red instead of white or transparent for visibility only.

enter image description here

In the left there's a red path and its black duplicate with much narrower stroke.

In the middle: Apply stroke to path to the wider curve, remove the fill, insert a narrow stroke and separate the edges with Path > Break Apart.

In this phase you must cut the paths to open at the closest possible nodes. Insert new nodes if there is none nearby. Closed path will cause a mess due the unpredictable starting point. A mess is still possible due opposite path directions, but you can fix it with Path > Reverse if needed.

The wide red path can be originally open path - maybe the start and end nodes in the same place - the duplicate is automatically open, but you must delete with the node tool and DEL the end segments after converting the stroke to path.

In the right The black and the outer red paths are selected and extension Generate from Path > Interpolate is applied. Style is interpolated, too and there's 40 copies (=enough to fill gaps). Then the same is done for the black and the inner red paths. The extension leaves the originals intact, they can be accessed in the layers panel.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.