That's brilliant - well done Zach.
This isn't strictly a tutorial per se, but I can find no better place to put this up. I created a GIMP Script-Fu plugin that will take any heightfield and generate a contour map of it. Somebody requested that I post it, so here it is.
There are two scripts: Contour Line, which adds one contour line to the heightfield, and Contour Map, which adds a lot of contour lines at once by calling Contour Line.
To install the scripts in GIMP, put both .scm files in any of the folders GIMP looks in for scripts (to find this out, go to GIMP Preferences→Folders→Scripts). Then refresh the scripts by going to Filters→Script-Fu→Refresh Scripts, or just by restarting GIMP.
The script expects a simple image in shades of grey, which represents a height field (see the first example image). Contour Map allows you to set the upper and lower bounds of height (to do the whole thing use 0 and 255 respectively), set the width of the contour lines, set how much elevation is skipped between lines, and set how much smoothing the lines will receive. The example maps are only 512 x 512, so there are a lot of little artifacts that would disappear on larger maps.
That's brilliant - well done Zach.
Perhaps I am the only one who had issues running these scripts, but here is what I figured out {in case it helps others}
When you are using a height map, make sure that you are using grey scale colors, but the image is in RGB.
The next step is to call the Contour Map script.
The following dialog should open, and the example here has already been filed out to what I was using at the time.
After adjusting the sliders / numbers to those that you want, clicky the Ok button. These settings made a busy topo map that took a minute or so to run.
These lines are tooo light for my liking. There are two options that can be done to correct this. The first option is to duplicate the Contour Map layer until the desired contrast is achieved. The other option is to delete the Contour Map layer and redo the script with a different Hardness selected.
I found 0.6 to be almost too dark when I re-ran the script, so this will be something that I will probably play with on every map. Of course it could just be the level of detail that I am having the script run with that is jamming everything together and looking busy.
And that was indeed the issue with this height map. I was changing the height difference too gradually which crams all of the contours ontop of each other. Not idea for the small-ish image that I am using, well previewing, as when the image is viewed at full resolution the lines are not so squashed.
From here artistic license can be given to the end user to allow some nice looking topo maps. Thanks for the scripts Zach!!!!
Sorry for the rambling.
Last edited by ltan; 10-09-2014 at 10:40 PM.
-L-
Hi Zach!
As a tip, to get smother strokes in your script, convert the selections to paths then stroke those.
For example, if you change this bit in your script:
to be:Code:(gimp-edit-stroke theLayer)
You will end up with smoother contour lines.Code:(plug-in-sel2path RUN-NONINTERACTIVE theImage theLayer) (gimp-selection-none theImage) (gimp-edit-stroke-vectors theLayer (vector-ref (cadr (gimp-image-get-vectors theImage)) 0)) (gimp-image-remove-vectors theImage (vector-ref (cadr (gimp-image-get-vectors theImage)) 0))
Here is an example (the stroked selection on the left half, the stroked path on the right half):
stroke.png
You could also go crazy and use the plug-in-sel2path-advanced command that lets you specify corner thresholds, align thresholds, and all other kinds of path tracing voodoo, but that could be overkill
-Rob A>
Last edited by RobA; 10-16-2014 at 12:39 AM.
My tutorials: Using GIMP to Create an Artistic Regional Map ~ All My Tutorials
My GIMP Scripts: Rotating Brush ~ Gradient from Image ~ Mosaic Tile Helper ~ Random Density Map ~ Subterranean Map Prettier ~ Tapered Stroke Path ~ Random Rotate Floating Layer ~ Batch Image to Pattern ~ Better Seamless Tiles ~ Tile Shuffle ~ Scale Pattern ~ Grid of Guides ~ Fractalize path ~ Label Points
My Maps: Finished Maps ~ Challenge Entries ~ My Portfolio: www.cartocopia.com
Thank you for this. A great tool to have. I PDFed it (because I'm anal like that).
Contour Lines-Maps in GIMP.pdf