Post Reply 

Selecting just a single line

Apr 11, 2012, 02:46 (This post was last modified: Apr 11, 2012 04:40 by DavidBrennan.)
Post: #1
Selecting just a single line
Let's say you just have a simple black line in Gimp. You then use the color select tool to select it, and you plan on then converting that Selection into a single line Path.

From: Rectselect

Into: Path

You select the line, but the Selection tool actually travels a loop around the line. So, when you turn that Selection into a Path, you do not have a single line, but you instead have a loop.

So my question is this: is there any mechanism for making your Selection in GIMP just a single line so that it can then be converted into a Path?

Originally, I was trying to achieve this in Inkscape (and started a thread about it in the Inkscape forum). However, it appears that, although other Vector Art programs can achieve this, Inkscape cannot. So I was thinking that I could instead use Paths in GIMP instead, but this is not possible because of the nature of Selections, as far as I can tell.

Does anybody have any thoughts about this? If anybody is capable of writing any sort of add-on for this, I think it would be very helpful to many people. I'm sorry that I'm incapable of doing so (one day, maybe).

Here's an attempt to illustrate this request:

[Image: Untitled-5.png]
Find all posts by this user
Quote this message in a reply
Apr 11, 2012, 06:18
Post: #2
RE: Selecting just a single line
In practice, using the path editor to create a path that follows your line is quick and gives a much better result, because a good path for a smooth line has got very few points and all algorithms tend to generate too many points.

Otherwise, once you have a loop as above, you can
- open it at each end using the path editor, to create two disconnected strokes
- delete one of the strokes (many shift-click if many points, or use my delete-strokes.py script/plugin)
- shift the remainingg stroke to the middle of the original line (it could be easier if you use my path-shift.py script)

The scripts and their docs are here:
http://sourceforge.net/projects/gimp-pat...s/scripts/
http://gimp-path-tools.sourceforge.net/

(if you use paths in Gimp you may find the other scripts useful as well).

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 11, 2012, 06:27
Post: #3
RE: Selecting just a single line
Thanks, OfNuts.

I was only using the single line as a simplified example. In practice, the goal would be to be able to "Select" single lines over much more complex shapes (and then convert them into paths).

This all started because I had this facial mesh as a .PNG, and I wanted to convert it into a single threaded Curve/Path graphic. However, all the methods of selecting it simply went around the perimeter, creating two parallel lines, rather than one line through the center of the black area.

In Inkscape, the usual tool would probably be its Paint Bucket. In GIMP, it's the Color Select tool. But they both end up selecting the perimeter of lines, not their centers.

Does that make sense?

[Image: FaceMesh.png]
Find all posts by this user
Quote this message in a reply
Apr 11, 2012, 10:17
Post: #4
RE: Selecting just a single line
Nose and mouths aren't lines. And a mesh like this asks a lot of questions. Do you want a stroke per segment? or keep full lines? but how do you determine/indicate the ones you want to keep as single lines?

Otherwise you have under 200 points (and under 100, if you do one side and use my mirror-path script to do the other side). On something as simple as this, you create 20 points /minute (all straight lines). One half done in 5 minutes... I' have done much more complex things (1200 points, with curves...)

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Apr 11, 2012, 14:20
Post: #5
RE: Selecting just a single line
This is just another example. The objective is to be able go generate Paths/Nodes through the center of a given line rather than around it, as GIMP (and Inkscape) currently do.

I don't need to have it done for that photo at all. It was just something that I was thinking about a few weeks back, and I thought it would be very useful.

For instance, if you want to make a Vector graphic out of handwriting, currently you'll have the two Paths running around the perimeter of it. It would be superior to at least have the choice to also just make a single line through the center.

But I don't actually need it done for anything right now, personally. But just as a feature of GIMP or Inkscape, it would be great, I believe. You can see the link above to the thread at the Inkscape forum for more discussion, if you'd like.
Find all posts by this user
Quote this message in a reply
Apr 13, 2012, 22:04
Post: #6
RE: Selecting just a single line
NOTE: I just learned that this is called "Centerline Trace". It is apparently going to be added to Inkscape in the next version (though Inkscape is very slow with its updates). If it would be possible for anybody to incorporate a Centerline Trace into GIMP, I think that that would be very popular.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Can't draw a clean line freehand Dave54 3 332 Jul 12, 2014 16:21
Last Post: Dave54
  command-line optimizing wmichaelv 7 928 Jun 11, 2014 08:26
Last Post: rich2005
  change Gimp from multi-window to single window moltres_rider 9 1,397 May 28, 2014 17:26
Last Post: rich2005
  How do I erase in a straight line? Terry50 2 489 May 12, 2014 03:11
Last Post: Terry50
  Can I make a line a specific size? jitter1127 3 780 Apr 25, 2014 08:58
Last Post: rich2005

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS