Joining strokes of a path - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +--- Thread: Joining strokes of a path (/Thread-Joining-strokes-of-a-path) |
Joining strokes of a path - Ottia Tuota - 07-19-2021 I made a small plugin to join strokes of a path. Only after finishing it I found that Ofnuts has an older plugin for the same purpose. But somehow, I was not very much surprised... But my plugin has different features, so I guess its publication is justified. Ofnuts' plugin is in his collection ofn-path-edits. Suppose you have a path with several strokes as here on the left: [attachment=6379] Some strokes have an end close to an end of another stroke. This plugin enables you to join such pairs of strokes, as is done on the right. In this example I deliberately made the path such that the stroke ends are not so very close, just to show the effect clearly. But suppose you have two strokes whose ends are practically at the same spot. Then you might really want to join the strokes into one. Or you have one stroke which is not closed but should be and its end anchors are at the same spot. This plugin closes the stroke properly. To get the plugin, go to http://kmarkku.arkku.net/Path_modify_files/Gimp_master.html scroll to the bottom, and click the right download button ("Join strokes"). You get a zip file. Unzip it and place the one file it contains (join_strokes.py) in your user's plug-ins folder. Then (re)start Gimp. To use the plugin: in the Paths tab, right-click a path and follow the links Tools > Modify path > Join strokes. I envision two cases where this plugin might be useful. First, suppose you are working with a picture where you want to extract an object. And you do it with the path tool, tracing around the object. You get a long path consisting of a large number of closely spaced anchors. And then somewhere along the way you left accidently small gaps. With this plugin you can close the gaps and get one long stroke. (At least if everything goes well: The plugin does not know which anchors belong together; it works only by distances.) I just wonder if there is some old tool for this task too... Second, you can build a figure from several strokes and afterwards join the strokes to one. The idea is the same as in Ofnuts' documentation for his plugin (as I later found out). I made the small path on the left. [attachment=6380] Then I copied and flipped it three times. Using guides (shown here) I moved the 4 paths to the positions on the right. Then I merged the 4 paths. Now I had one path with 4 strokes, forming one figure. The stroke ends were practically on top of each other. Then I called my plugin. It joined the 4 strokes to one closed stroke. The plugin lets you decide how close stroke ends are joined together. The default distance is 0.5 pixels. In the first picture above I used 40 pixels. The plugin allows you to decide how the joining is done: either by replacing two anchors with one new anchor; or putting there a small smooth arc; or putting there a small straight edge. Here is an example of each: [attachment=6381] The plugin also allows you to use a selection to restrict the effect to only some stroke ends. Please report any erronous functionings. All suggestions are welcome. RE: Joining strokes of a path - Ofnuts - 07-19-2021 Your second example is my path-mirror script RE: Joining strokes of a path - Ottia Tuota - 07-19-2021 (07-19-2021, 11:45 AM)Ofnuts Wrote: Your second example is my path-mirror script I should have guessed! RE: Joining strokes of a path - Krikor - 07-19-2021 Great! I experimented a little and liked the practicality and intuitive way in which the plugin behaves. Being able to decide on the distance at which the ends of the strokes meet greatly facilitates the union or connection between strokes. Thank you very much! (07-19-2021, 11:45 AM)Ofnuts Wrote: Your second example is my path-mirror script I couldn't resist, and as a good "commensal" I had to check this plugin (path-mirror). Although without an explanatory .html (as there is for most plugins under the Ofnuts subscription), it was still easy to find out which Menu it was in and even easier to use it. Good that allows you to generate the mirroring as a single stroke or not! Thank you very much! |