The Cartographers’ Guild is a forum created by and for map makers and aficionados, a place where every aspect of cartography can be admired, examined, learned, and discussed. Our membership consists of professional designers and artists, hobbyists, and amateurs—all are welcome to join and participate in the quest for cartographic skill and knowledge.

Although we specialize in maps of fictional realms, as commonly used in both novels and games (both tabletop and role-playing), many Guild members are also proficient in historical and contemporary maps. Likewise, we specialize in computer-assisted cartography (such as with GIMP, Adobe apps, Campaign Cartographer, Dundjinni, etc.), although many members here also have interest in maps drafted by hand.

If this is your first visit, be sure to check out the FAQ. You will have to register before you can post or view full size images in the forums.

How can I do a limited/masked gradient fill in GIMP?

Lately I've been messing around with GIMP, trying out new techniques as I come across them. Anyways, I'm probably just overlooking this feature, but is there a way in which I can do a 'shape based' gradient fill that plateus at a certain value and shape. Another way of wording it would be; can GIMP blend between 2 different coloured shapes (one atop the other) resulting in a gradient between the two?

Here is an example of what I mean. Just a very simple image with one shape on top of another.

I've had a look at the 'interpolate' function of Inksacpe, but it requires each shape to have the same number of nodes and results in intermediate steps being smaller than the final image.

I'm not entirely sure what you're trying to achieve. Is the black-colored area in your example image supposed to be where the gradient would be? So there'd be gradient going from the outer edge of the area to it's inner edge?

I don't think there's any easy way to do this in GIMP. There are ways (blurs, bevels) to create a black to white gradient to surround the inner area, but these would all result in the gradient being of equal thickness in all directions. That is, it would match the shape of the inner edge but not the outer one.

Although perhaps you could create two gradient masks, one based on the inner edge and the other one on the outer edge, and combine them by setting blend mode to multiply.

I toyed a bit with that example pic and came up with this method for creating something like the effect you're after. Unfortunately the shapes of the inner and outer edges of the gradient zone are not preserved 100% accurately, but you do get a fait approximation of them.

First, you'll need to create two layers, one for working on the inner edge of the gradient, and another for working on the outer edge. Notice how I've inverted the black & white for these:

Let's edit the layer that contains only the inner shape first. Select the WHITE area and apply a Gaussian Blur (I used 120 pixel width) on it:
This will create a gradient that smoothly darkes around the inner edge, yet maintains it's shape. Note, however, that the gradient only goes from white to gray, NOT white to black.

To fix this issue, make copies of the layer and set their blend modes to "multiply", then merge them. The result will be a single layer that contains a gradient from white to black, but without messing up the shape too much. You'll likely see a better quality result if instead of copying the same blurred layer, you create each layer manually and use a different Gaussian Blur width for each. Once you've merged the layers, invert the colors:

As for the outer edge, just use the same kind of process, but without inverting colors at the end:

Now you should have two gradient layers, one for the inner edge and one for the outer edge. Place them so that the INNER shape gradient is above the OUTER one. Set this topmost layer's blend mode to "multiply" and set it's opacity to 50%. This should result in the final gradient band, limited by the designated shapes of the inner and outer edges, though not quite perfectly:

You can merge the inner and outer gradient layers to get a single layer containing this final gradient, which can then be used for a mask.

Thanks muchly for the detailed reply. It's definitely something I will have to try. I think I'm currently onto something using Wilbur as well, though I haven't had a chance to check it out properly yet.

Anyways, the use for all of this will be to set gradients below and above 'sea level' with upper and lower contour guides, whilst maintain the original shape of the landform. I can't think of a better way to explain what I'm after. If I'm going about this completely wrong and there is some easier way to accomplish my goal, I can't see it..

Contour Lines?

Would this GIMP script be useful? To use it, you need to have your shape as the only non-alpha portion of the GIMP image. This script converts the image to a square, does a rectangular-to-polar conversion, and does a linear gradient down each column along the non-transparent portions of the drawing before going back to rectangular coordinates. It can also do contours, if you so desire. The script will show up in the Filters/SambrookJM menu under GIMP.

It's not perfect, but it could be a good starting point. It's not a fast script at all, so any ideas on how to speed things up would be greatly appreciated. I'd also like to know how you delete the selection-mask channel, since the ways I've tried haven't worked.