Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a path from the center points of a selection?
#14
(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.
Reply


Messages In This Thread
RE: Creating a path from the center points of a selection? - by Ofnuts - 11-15-2020, 04:34 PM

Forum Jump: