Gimp-Forum.net
Creating a path from the center points of a selection? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Creating a path from the center points of a selection? (/Thread-Creating-a-path-from-the-center-points-of-a-selection)

Pages: 1 2


RE: Creating a path from the center points of a selection? - mholder - 11-14-2020

I am just literally following the directions.  I expect something wrong when I choose crop path by rectangle, and I don't specify any rectangle.


RE: Creating a path from the center points of a selection? - Krikor - 11-14-2020

A simple option, although applicable only to specific situations like the one raised in this topic would be:

With the Pencil Tool selected, center your starting point in the axi-longitudinal center of the line;

Initial click, holding ctrl + shift and keeping the Pencil Tool selected it is possible to create a 45 degree offset angle.
Select the end point and click.
[attachment=5197]
Then alpha for selection, Select to path.
[attachment=5198]

(11-14-2020, 02:11 PM)mholder Wrote: Ok got it thanks!

I tried this: 
- select the black line with the Fuzzy Selection Tool     (ok)
gimp menu :
- Select / To Path  (ok)
- Select / None     (ok)
- on path, right click : 
  - Tools / Cropping and Slicing / Crop path by rectangle  (error, then I use canvas option)
  - Edit / Break path apart   (ok)
  - Tools / Generate intermediate paths  (3)    (does nothing)

So what am I doing wrong here?  I can already think of many uses for this if I can get it to work.

mholder, I also tried these steps brilliantly designed by denzjos, but literally following the steps will not work. At least with me it was like that, starting with the same initial mistake that you also got.
But I also found others, after break path apart it was impossible to generate intermediate paths since the paths created had different numbers of strokes.

But the idea of denzjos is excellent and it works, you just need to adjust the steps.
(11-14-2020, 02:29 PM)Ottia Tuota Wrote:
(11-14-2020, 02:11 PM)mholder Wrote: I tried this: 
...
  - Tools / Cropping and Slicing / Crop path by rectangle  (error, then I use canvas option)
...

Could you please tell: What error? What kind of a path? What rectangle option you tried - rectangular selection, guides, or active layer? A picture would tell much. Errors may mean bugs in the code, so I am interested.

If you use the canvas option, it may well be that cropping does nothing, depending on the situation.

Ottia Tuota,

The plugin works correctly.
But following the steps taken, there is no selection made, so this error appears by the mholder. The same happened to me when I tried to follow the steps literally.


RE: Creating a path from the center points of a selection? - denzjos - 11-14-2020

(11-14-2020, 03:26 PM)mholder Wrote: I am just literally following the directions.  I expect something wrong when I choose crop path by rectangle, and I don't specify any rectangle.

Must draw a rectangular selection first (rectangular select tool), then use the plugin. In my example a roughly drew a rectangle, but you can draw the rectangle just at the beginning and the end of the line (cutting where the line is rounded).

(11-14-2020, 03:30 PM)Krikor Wrote: A simple option, although applicable only to specific situations like the one raised in this topic would be:

With the Pencil Tool selected, center your starting point in the axi-longitudinal center of the line;

Initial click, holding ctrl + shift and keeping the Pencil Tool selected it is possible to create a 45 degree offset angle.
Select the end point and click.

Then alpha for selection, Select to path.


(11-14-2020, 02:11 PM)mholder Wrote: Ok got it thanks!

I tried this: 
- select the black line with the Fuzzy Selection Tool     (ok)
gimp menu :
- Select / To Path  (ok)
- Select / None     (ok)
- on path, right click : 
  - Tools / Cropping and Slicing / Crop path by rectangle  (error, then I use canvas option)
  - Edit / Break path apart   (ok)
  - Tools / Generate intermediate paths  (3)    (does nothing)

So what am I doing wrong here?  I can already think of many uses for this if I can get it to work.

mholder, I also tried these steps brilliantly designed by denzjos, but literally following the steps will not work. At least with me it was like that, starting with the same initial mistake that you also got.
But I also found others, after break path apart it was impossible to generate intermediate paths since the paths created had different numbers of strokes.

But the idea of denzjos is excellent and it works, you just need to adjust the steps.
(11-14-2020, 02:29 PM)Ottia Tuota Wrote:
(11-14-2020, 02:11 PM)mholder Wrote: I tried this: 
...
  - Tools / Cropping and Slicing / Crop path by rectangle  (error, then I use canvas option)
...

Could you please tell: What error? What kind of a path? What rectangle option you tried - rectangular selection, guides, or active layer? A picture would tell much. Errors may mean bugs in the code, so I am interested.

If you use the canvas option, it may well be that cropping does nothing, depending on the situation.

Ottia Tuota,

The plugin works correctly.
But following the steps taken, there is no selection made, so this error appears by the mholder. The same happened to me when I tried to follow the steps literally.

If forgot to mention to check if there are more than two anchor points on each path. If there are, delete them in the path edit mode. If there is still no path made with the generate intermediate paths, then use the Ofnuts plugin : sort strokes horizontally (or vertically) or/and reverse strokes (on one path only)


RE: Creating a path from the center points of a selection? - Ofnuts - 11-15-2020

(11-13-2020, 11:33 PM)eepjr24 Wrote: If I have a selection, for simplicity sake we'll start with a 50 pixel wide line at a 45 degree angle from top left to bottom right. How do I create a path that traverses the approximate center of the selection and is one pixel wide?

I know how to create a selection, shrink a selection, create a path from a selection. But simply shrinking will either end you up with gaps in the path or with areas that are wider than a pixel in the path if there is any deviation in the width. I am fine if this is something I need to do programatically (learning Python, know multiple other languages) if someone can point me in the right direction or the terminology to look for to execute this type of operation. I am no great mathematician, but I can muddle through most geometry and basic trig. And I am fine with putting in time to experiment as necessary.

Edit: Using GIMP 2.10.22 but can upgrade if needed, Win 10 64 bit.

- Ernie

Two ways with my scripts:

If you use ofn-hatchings, the center line is guaranteed to go through the center of the layer so you can
  • make a layer the size of the selection (Layer>Crop to selection),
  • apply a hatching with a very large spacing,
  • if necessary merge the resulting layer in your initial layer
Otherwise a small function of my ofn-path-to-shape script, the crosshair:
  • rectangle selection
  • Select>To path
  • Shapes>On Strokes>Circle>Crosshair. This creates two lines, one being a diagonal of the initial rectangle (they are actually orthogonal diameters of a circle that goes through the first three points of the path stroke). Delete the one you don't want. If you are not lucky, edit the rectangle path and delete one of the corners, one of the two diameters line will always run from the first to the third.



RE: Creating a path from the center points of a selection? - Ofnuts - 11-15-2020

(11-14-2020, 01:42 PM)mholder Wrote: " - Edit / Break path apart"

Ok which script does this?

@Ofnuts: Is there a single zip file with all your scripts?

No sane person wants the whole collection. I don't even have them all installed (some of them are really niche stuff).


RE: Creating a path from the center points of a selection? - Krikor - 11-15-2020

(11-15-2020, 04:34 PM)Ofnuts Wrote: Two ways with my scripts:

If you use ofn-hatchings, the center line is guaranteed to go through the center of the layer so you can
  • make a layer the size of the selection (Layer>Crop to selection),
  • apply a hatching with a very large spacing,
  • if necessary merge the resulting layer in your initial layer
Otherwise a small function of my ofn-path-to-shape script, the crosshair:
  • rectangle selection
  • Select>To path
  • Shapes>On Strokes>Circle>Crosshair. This creates two lines, one being a diagonal of the initial rectangle (they are actually orthogonal diameters of a circle that goes through the first three points of the path stroke). Delete the one you don't want. If you are not lucky, edit the rectangle path and delete one of the corners, one of the two diameters line will always run from the first to the third.
Wowww O.O
This was even easier and faster than the solution I suggested with Pencil Tool!

I was never able to install ofn-hatching, I don't remember what the difficulty was exactly, but I think I had to configure something.

Ofn-path-to-shape is a plugin gem! I wonder when the developer version will be released. :-)

The good thing about this type of doubts is that they make us learn to know better certain plugins that we have and we don't even know the potential they have.


RE: Creating a path from the center points of a selection? - denzjos - 11-16-2020

Ofnuts, I like the ofn-path-to-shape solution. Amazingly simple.


RE: Creating a path from the center points of a selection? - eepjr24 - 11-16-2020

Thanks all for the solutions! Hopefully I get some time this week to install the ofn tools and try it all out.

- E