I would really appreciate some help with this little problem I have, it may only be a click away somewhere in a menu - perhaps someone can help. The application I'm using is Inkscape and I'm trying to find a way to quickly merge the overlapping nodes of a single object. Because the shape's nodes have been randomly jittered they are now overlapping each other - which is exactly what I want but not the white 'negative' spaces. I would like to achieve the result shown on the right of the picture (this was done outside Inkscape using Photoshop) perhaps you can help?
2 Answers
Here is a simplified example of what we're trying to do:
Note that changing the fill rule will not give the desired results.
How to do it:
- Make sure all objects in your design are paths.
- If you have multiple objects in your design, choose "Path" > "Union" to merge them into one object.
- Draw a filled rectangle entirely around your entire design path and choose "Object" > "Lower to bottom" to put the rectangle below your design path.
- Select both the rectangle and your design path and choose "Path" > "Difference".
- Select the resulting path object and choose "Path" > "Break Apart" to produce multiple path objects for each region of the design.
- Using the select tool, click near the corner of the whole rectangle to select the rectangle object.
- Delete the outer rectangle you just selected.
- Select all the objects that are left over and choose "Path" > "Union".
Tested using Inkscape 0.48.4
Very cool question, by the way!
-
It seems so complicate: why not just apply the non zero fill-rule using the proper button? Feb 27, 2015 at 10:18
-
@PaoloGibellini I added some screenshots to explain why changing the fill-rule is not a viable solution in this case.– SeanFeb 27, 2015 at 13:06
-
-
@PaoloGibellini I added the border only to better illustrate the solution process. If you are implying that (besides the border issue) you still think a non-zero fill rule would be able to accomplish this task, I'd love to see you demonstrate it by adding an alternate answer to this question. I'm genuinely curious. Fill rule was my first thought too, but I couldn't get it to work for a case like this.– SeanFeb 27, 2015 at 14:13
-
I have interpreted the question as the wish to have the object uniformly filled, and a fast way to achieve this result is changing the fill rule. Your solution is more complicate but also more comprehensive, because it leads to a new and more flexible object (and probably with less nodes). Which version of Inkscape have you used? Feb 27, 2015 at 17:41
0. Initial path
- Fill-rule: nonzero
- Path union (Ctrl +, it works for one path as well)
- Break apart (Ctrl Shift K)
- Path union one more time (Ctrl +)
-
I like this approach, and I am able to replicate this solution process by drawing a path like yours. BUT this solution only removed 1 of the 3 holes in the path from my example solution. Your solution seems better for your example case because it is fewer steps. But it does not appear to remove all holes in all cases.– SeanFeb 27, 2015 at 20:39
-
@SeanMadsen Indeed, my random path is not so random. In general case your surrounding rectangle helps a lot. Feb 27, 2015 at 20:57
-
This solution seems faster, but doesn't work in some conditions, e.g. when the "hole" has at least two nodes in the external path. In this case after breaking apart you have "filled" paths connected by vertex, and no "not filled" path to merge using the union. For this case you can use @SeanMadsen method, with a few variants. Mar 1, 2015 at 5:53