Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Shrinking a selection to ~1px width
#1
Is it possible to shrink a selection to, for example, 1px width without the selection disappearing in the thinner areas?

Let me give you an example. In the image below, I have selected the "walls" at the edges of this map, shrunk that selection slightly and converted it to a path (in green). The problem is that when I convert it to a path, what I'd like is to instead have a single line through the middle of those walls, instead of two bordering the selection. But if I shrink it too much, some parts of the selection will completely disappear and I think that even if I managed that, the selection to path tool would create two lines anyway bordering the selection.

Perhaps a better question would be, can I create a path from a selection by filling in that selection instead of using the borders for the path?


Thank you!

[Image: 6sUSXad.png]
Reply
#2
I don't know if I understood correctly, but you could instead make a selection, trace the path and then do Edit - Stroke path.
Result: the yellow line in the image.
   

Or fill the entire selection (green color) and then remove the center of that selection.
   
Reply
#3
(04-22-2021, 12:03 AM)Krikor Wrote: I don't know if I understood correctly, but you could instead make a selection, trace the path and then do Edit - Stroke path.
Result: the yellow line in the image.


Or fill the entire selection (green color) and then remove the center of that selection.

Thank you for the prompt reply, Krikor!

The end result I need is the center line as a path. When I make the "selection > to path", I get the green lines marking the outline of the selection. If I then use Stroke Path, it also creates a stroke following those outlines, not at the center. If in Stroke Path I increase the line width enough that it covers the whole selection, I'm back at the beginning, unless perhaps I'm misunderstanding how it works?. (I don't want to manually trace the path, I'm trying to do it automatically).
Reply
#4
Use the Paths tool (B) -  Path , drawing the desired line and then stroke as shown in yellow in my previous post.


Attached Files Image(s)
   
Reply
#5
Fror hazy memory, there is a thing called "center trace" somewhere (Inkscape plugin?). I assume Rich will chime in for this.

Otherwise, since your path seems to fall on a regular grid, you can define an image grid that overlays you image grid, activate View ➤ Snap to grid and then drawing your path will be a snap, if you pardon the pun.

   
Reply
#6
Quote:Fror hazy memory, there is a thing called "center trace" somewhere (Inkscape plugin?). I assume Rich will chime in for this.

Broken in Inkscape 1.x  which has moved on to python 3. Get an old version  (0.9x) of Inkscape + Autotrace

For Gimp: 

Centerline-trace. In this case probably not worth the effort. Assuming the wall is easily extracted on its own layer, those corner rectangles (wall pillars ?) (1) create spikes in the trace.  I can smooth with a small gaussian blur followed by threshold (2). Then run the autotrace plugin. Not a wonderful result (3)

   

The plugin is here: http://gimpchat.com/viewtopic.php?f=9&t=17485 Also the autotrace executable https://github.com/autotrace/autotrace/r...0200219.65
Reply


Forum Jump: