# Gimp-Forum.net

You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
I tried this:
- select the black line with the Fuzzy Selection Tool
- Select / To Path
- Select / None
- on path, right click :
- Tools / Cropping and Slicing / Crop path by rectangle
- Edit / Break path apart
- Tools / Generate intermediate paths  (3)
done (maybe ofnuts can suggest a shorter way to do this)
[attachment=5192]
For a single pixel, it is going to be either, paint in by hand with the pencil tool, or stroke a path again with the pencil tool.

No way that I can see for exact end-to-end other than manual editing.

Assuming the line is going to be something more that a single diagonal line, there is a plugin that uses an external program 'autotrace' see: http://gimpchat.com/viewtopic.php?f=9&t=17485

Might look like this:

[attachment=5193]

An alternative is the Inkscape application (use last 0.92 series) which does the same and has autotrace built in.
- on path, right click :
- Tools / Cropping and Slicing / Crop path by rectangle
- Edit / Break path apart
- Tools / Generate intermediate paths  (3)

Where do I find these options?
the rest can you find in the Ofnuts download table : https://sourceforge.net/p/gimp-path-tool...3708eac697

@Rich, after stroke the line it is not possible to get a 1 pixel line, the outlines are 1 pixel.
[attachment=5194]
(11-14-2020, 11:52 AM)denzjos Wrote: [ -> ]@Rich, after stroke the line it is not possible to get a 1 pixel line, the outlines are 1 pixel.

Sorry, I do not really understand the question, however there is a difference between stroking a path with a 1 pix. anti-aliasing off, line and stroking with a 1 pix pencil tool.

[attachment=5195]
" - Edit / Break path apart"

Ok which script does this?

@Ofnuts: Is there a single zip file with all your scripts?
(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?

ofn-path-edits.py
Ok got it thanks!

I tried this:
- select the black line with the Fuzzy Selection Tool     (ok)
- 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.
(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.
Pages: 1 2