Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a customizable dashed line along curve
#1
Hi, I am new to these forums and apologize if this is not the right place.

My question is, how can I make a dashed line along a curved path or something similar, and still be able to customize the spacing?
To make it clearer: I am making a map, and on this map there are going to be several dashed lines with the same size (80x25 px). However the spacing between the dashed lines is something I want to vary, so that certain places on the maps have large gaps between the dashed lines and others have close spaces between the dashed lines. Additionally I want to make the dashed lines follow smoother curves to make them prettier, as it looks wrong with straight lines.

What I've tried so far:
- Stroke path - stroke line using a line style (This works great, but I have problems varying the gaps between the dashed lines. If i set to line length to squares, I cant have more than 3 squares as spacing. This works fine some places, but I need larger spacings other places)
-Drawing the dashed lines by hand, this takes ages and is easy to mess up, and my attempts have looked awful
-using shift click with the correct angel setting and spacing to create dashed lines. The problem here is it looks too straight and therefore not good.
-Using dynamic brush "Track Direction", this doesnt work. It is simply way too innaccurate


Using windows 10 and Gimp 2.10 if that helps

Thank you for any help


Attached Files Thumbnail(s)
       
Image(s)
   
Reply
#2
Maybe this one, a plugin replicate_path_along_path.py
 from http://kmarkku.arkku.net/Path_replicate_...aster.html

It might take more than a bit of fiddling around with variables but for example.

A rectangular path - the 'dash' - made from a selection-to-path
A base path and the position of this does matter.
The path to follow.

   

Which gives this and you need to fill that new path Edit -> Fill Path.

   
Reply
#3
(04-13-2024, 11:06 AM)OJS Wrote: If i set to line length to squares, I cant have more than 3 squares as spacing.
Uh? Works fine for me...

   
Reply
#4
(04-13-2024, 12:14 PM)rich2005 Wrote: Maybe this one, a plugin replicate_path_along_path.py
 from http://kmarkku.arkku.net/Path_replicate_...aster.html

It might take more than a bit of fiddling around with variables but for example.

A rectangular path - the 'dash' - made from a selection-to-path
A base path and the position of this does matter.
The path to follow.



Which gives this and you need to fill that new path Edit -> Fill Path.

Thank you! This is working, although it requires a bit of fiddling for each path that uses different spacing, but it should do the trick!

(04-13-2024, 02:00 PM)Ofnuts Wrote:
(04-13-2024, 11:06 AM)OJS Wrote: If i set to line length to squares, I cant have more than 3 squares as spacing.
Uh? Works fine for me...

I might have expressed myself in a confusing way. I mean that if is set the dash length to 3 squares then I am stuck with 3 squares as spacing, or 9 squares. There is no more room for customization, unless you add smaller dashes in between. At least as far as I can make it out.

It would be nice to for example have 3 square dash with 4 square spacing, or 3 square dash with 5 square spacing, etc.
Reply
#5
(04-13-2024, 02:20 PM)OJS Wrote: I might have expressed myself in a confusing way. I mean that if is set the dash length to 3 squares then I am stuck with 3 squares as spacing, or 9 squares. There is no more room for customization, unless you add smaller dashes in between. At least as far as I can make it out.

It would be nice to for example have 3 square dash with 4 square spacing, or 3 square dash with 5 square spacing, etc.

As usual I was overthinking, although same as you I find that custom dialogue less than wonderful.

You can edit in your Gimp profile gimprc file as this.


Attached Files Thumbnail(s)
   
Reply
#6
(04-13-2024, 02:31 PM)rich2005 Wrote:
(04-13-2024, 02:20 PM)OJS Wrote: I might have expressed myself in a confusing way. I mean that if is set the dash length to 3 squares then I am stuck with 3 squares as spacing, or 9 squares. There is no more room for customization, unless you add smaller dashes in between. At least as far as I can make it out.

It would be nice to for example have 3 square dash with 4 square spacing, or 3 square dash with 5 square spacing, etc.

As usual I was overthinking, although same as you I find that custom dialogue less than wonderful.

You can edit in your Gimp profile gimprc file as this.

Can you elaborate please? I tried changing my gimprc file's dash info to the numbers in your picture, but there was no change. I dont rightly know what the different numbers do. Oh and do I have to restart gimp each time i change it?
Reply
#7
(04-13-2024, 02:46 PM)OJS Wrote: Can you elaborate please? I tried changing my gimprc file's dash info to the numbers in your picture, but there was no change. I dont rightly know what the different numbers do. Oh and do I have to restart gimp each time i change it?

You will have to experiment. It seems the first 4 is a dashed pattern the next parameter will give a broken path. Final 3 parameters length and spacing.  You will need to restart Gimp after editing for Gimp to re-read the settings.

   
Reply
#8
(04-13-2024, 02:46 PM)OJS Wrote:
(04-13-2024, 02:31 PM)rich2005 Wrote:
(04-13-2024, 02:20 PM)OJS Wrote: I might have expressed myself in a confusing way. I mean that if is set the dash length to 3 squares then I am stuck with 3 squares as spacing, or 9 squares. There is no more room for customization, unless you add smaller dashes in between. At least as far as I can make it out.

It would be nice to for example have 3 square dash with 4 square spacing, or 3 square dash with 5 square spacing, etc.

As usual I was overthinking, although same as you I find that custom dialogue less than wonderful.

You can edit in your Gimp profile gimprc file as this.

Can you elaborate please? I tried changing my gimprc file's dash info to the numbers in your picture, but there was no change. I dont rightly know what the different numbers do. Oh and do I have to restart gimp each time i change it?

Something you could try to is stroke the same path with different patterns
Reply
#9
Thank you so much for you help. I have decided to use the gimprc file to adjust the dash patterns and just stroking the same path till i find the ones I like. This seems to be a quick and elegant solution.

Again, thanks a bunch!
Reply
#10
Found this here via Startpage search engine, while working with a 1980's vintage engineering drawing, and I wanted to put a dash-dot-dash dimension line into the image, and... oh boy.

I'm putting this here in the hopes that it will be of some use to anyone else out there using GIMP who's attempting to create a line by stroking a Path, who wants some sort of dashed line. What I originally wanted was a simple-enough dash-dot-dash line, which I could customize to well-enough match the existing lines on the 4000 pixel-width image I'm working with.

Please find the results of my investigations below, with profuse thanks and appreciation to rich2005 for putting me on to the existence of, the purpose of, and the location for, the gimprc file which controls this stuff (and a whole lot more, too). For what it may be worth, I'm running GIMP 3.0 as a appimage in Linux Mint. Find that file in Linux Mint, altering your username of course to suit, here: /home/mxm/.config/GIMP/3.0/gimprc

Note: All quotes in the below text are added by myself, and do not exist in the gimprc file in the area of interest.

There is a line in gimprc which needs attention and it's down near the bottom, under the heading of "(stroke-options" and yes, that prepending "(" is important, as is all the rest of the contents of this file, so please BE CAREFUL, lest you blow the whole place up, ok?

The line in question begins with "(dash-info " and those letters are followed by a very arcane string of numerical digits, and it's those numerical digits that run the show.

What I'm using right now, which renders a pleasing (to me) dash-dot-dash pattern for a line that I've specified as 4 pixes wide looks like this,

(dash-info 5 10 3 0.5 3 2.5)

and following the letters, we have SIX numerical digits, which I will (creatively enough) refer to as First, Second, Third, Fourth, Fifth, and Sixth, going in left to right order, and just to make sure we're all on the same page with that, the First Digit in that string is a "5" and the Sixth Digit in that string is a "2.5".

The First Digit tells the line-stroking part of GIMP that we're going to have a Dash-Dot-Dash pattern here, and if you look close at what I just wrote, you will see that "Dash-Dot-Dash" is a FIVE-part term, with three words separated by two dashes, and this helps me remember what I'm doing, which is why I point it out here.

If that First Digit had been a "7", the string would have included a pair of additional digits, and the sense of things would be that we would now have a Dash-Dot-Dot-Dash line stroke, and again count up the words and dashes and it adds up to 7 so... ok. You can add as many more terms as you might want to. We'll stick with Dash-Dot-Dash with its prepending 5 for now.

Again, First Digit tells it how much dash and dot we're gonna get.

Second Digit is the LENGTH of the First DASH, and this stuff is done as a sort of MULTIPLIER of the Line Thickness, which is specified elsewhere.

Third Digit is the LENGTH of the First SPACE, following that First Dash.

Fourth Digit is the LENGTH of the Second DASH (ok, it's a DOT, but you know what I mean), following the First Space after the First Dash, and if I'd specified it at the same value as the First Dash, then we'd simply have a repeating-dash pattern, instead of Dash-Dot-Dash.

Fifth Digit is the LENGTH of the Second SPACE, following the Second Dash.

And the Sixth and Final Digit is another multiplier, which works on the First Dash, and I've got a feeling if I was to put more numbers in there after it, I'd be multiplying subsequent Spaces and Dashes, but I've been at this all morning, and... not now, ok?

So.

For my Dash-Dot-Dash pattern, the digits for the  two SPACES get specified at the SAME VALUE, and that keeps the DOT between the DASHES correctly centered (which of course means that if I wanted to offset things for any reason, I could cause those numbers to be different, and that would cause the dot to be offset in the resulting line-stroke pattern. Additionally we do not need to further specify length/location, because the First Digit, the "5" tells it to start repeating with a new Dash of the same length as the First Dash, and on and on it goes, merrily dashing and dotting away, for the length of whatever Path we decided to Stroke.

And once you've figured this one out, you need never again find yourself at the mercy of that little GUI for Custom Dash Pattern which you get in the Choose Stroke Style dialog box when you tell GIMP you want something a little more involved than just a simple solid line. That little GUI thing is DIFFICULT to use (for me anyway) and knowing that I can specify things NUMERICALLY in the gimprc file is a HUGE improvement for me.

Here's the image in question, where I was experimenting around with this thing, stroking successive Paths, altering the (dash-info parameters as I went along.

[Image: Path%20Stroke%20Parameters%20Decoded%20O...0label.jpg]
Reply


Forum Jump: