|
Drawing dashed lines would seem to be one of the most obvious functions of any
painting program, but it's remarkably hard to find any information on how to do them in Gimp.
Hence this page.
I'm absolutely no Gimp expert, so there are probably better ways to do it. Still, these work.
I'm assuming you know the names of the various basic tools in Gimp and how find them
in the menu/toolbox.
This is fairly obvious - select the paint tool, set the foreground colour, and draw
the dashed line freehand. This works okay unless you want to draw a straight dashed
line.
You can draw a straight solid line in Gimp by clicking on the start point, holding down the
Shift key, and clicking on the end point. Then you can use the eraser tool to break it up
into dashes. To prevent the eraser from blanking out detail in the original image, it's
convenient to draw your dashed line on a separate layer (see the
note on layers).
In fact, it's worth using a layer for doing almost anything in Gimp, if only because corrections are easier.
This applies in Gimp 2 onwards - Gimp 2 has vastly improved facilities for 'stroking' a 'path', compared with Gimp 1.
A 'path' is just a fancy name for an invisible line defined by the user. 'Stroking' it means laying down patterns or marks on the path. So -first create the path, then 'stroke' it with your chosen pattern. It's a good idea, as always, to do this on a separate layer.
For example, if I want to draw in a track alongside the stream on
this map:
Step by step, this is how:
Create a new layer with Layer - > New layer
Select the layer you want to use with Dialogues -> Layers
and select the layer by clicking on it (this step may be superfluous
as the new layer will usually be the operative one anyway)
Use Tools -> Paths and mark the path by clicking on a series
of 'anchor points' along it (as many points as you like). You can back
up with Edit -> Undo Add Anchor or Ctrl-Z.
Having defined the 'path', you can now add the markings you like -
first make sure you've selected the colour you want by clicking on
the colour selector in the toolbox. Then use Edit -> Stroke Path.
This brings up the Stroke dialogue.
For our purposes, wanting a thin dashed line, we select 'Stroke Line' with
a line width of 1.5 pixels (it doesn't have to be a whole number of
pixels), and click on Line Style and edit the dash pattern to give some
dashes. Then click on 'Stroke' to complete the process.
Here's the result:
Then you can, if you wish, select Layer -> Merge down
or Image -> Flatten Image to merge the layers. I usually
don't bother, since just File -> Save As and giving it a name
of e.g. Mymap.jpg will cause Gimp to open a dialogue which
will guide me through 'Exporting' the image which will merge the layers in
the process.
If you want to save the separate layers for future use, then File -> Save As
an .XCF file before merging the layers.