View Full Version : Tiling with the Gimp

04-27-2007, 08:42 AM
Here is how you tile with the Gimp.

Choose a tile size, although you are not restricted to one. I have found a lot of nice, free, 20x20 tiles people have made for a program called Dungeoncrafter, a Windows-only application that I was never able to try out. I downloaded tiles a long time ago. So I have started doing 20x20 tiles, but I am also keeping 16x16, and I may use bigger ones for large terrain.

To make a jpg file into a tile for use with the Gimp, you need to make a brush from it. Specifically, you need to make a color brush. Brushes can be greyscale with a white background, and will paint in your foreground color, or color with a transparent background, and will paint in the colors specified in the brush. We want the latter for tiling.

Open your jpg file in the Gimp. Choose select all (ctrl-A), copy the entire image (ctrl-C), create a new layer with transparent background, (Layer ... New Layer, and choose "Tranparancy" as your layer fill type, the fourth choice,) trash the original background layer by selecting it in the Layers dialog and clicking on the trashcan, and paste the image into the new layer (ctrl-V, ctrl-H to anchor it.) That is the easiest way to get a single transparent background layer. Now you need to save it as a .gbr file, and put it in your brush search path.

Naming your brushes is actually the trickiest part. When you save the file, you will first be prompted for a file name, and then for a brush name, or "brush description". All the brushes you have in your search path will appear alphabetized by brush name (what the Gimp calls brush description when you save it.) If you want your tiles to be organized in any fashion, you will have to prefix the ones you want shown together with the same prefix. You can display your brushes in any number of tabbed brush dialogs, each scrolled to different sections, so all your brushes should be available with just a click, but they must be named so you can access them easily that way.

(When you save the brush, you will also be asked for a spacing. Choose 100. This is the percent of the size of the brush it will go before recopying if you drag your cursor, so you can tile a long straight line if you wish, usually without problems, if that is set to 100.)

Now, once you have a lot of brushes--I imagine you can make them en masse from your jpegs with a script, but I haven't been able to get Python running to find out--you need to put them in your search path.

Here is another little kludge to make the Gimp work for tiling, which is not really what it is designed for.

The Gimp's "brush search path" can be found under File ... Preferences ... Folders ... Brushes. It is a list of directories (folders) in which the Gimp will look for brushes. Any brushes (.gbr, .gih, or .vbr files) found in these folders will appear in the brush list. You can add as many folders as you wish to the brush search path. If you change your brush search path, you will need to quit and restart the Gimp in order for those changes to take effect. But if you just change the contents of those folders, you can "refresh brushes" (Brushes ... Brushes Menu ... Refresh Brushes) to get the new brushes to appear immediately.

You can manage your brushes, if you don't want all of them to appear at once, by including a lot of folders in the brush search path, and only putting the folders there when you need them.

For instance, within folder My_Brushes, I might put a bunch of folders, all included in the brush search path, and another folder, "Not in Use," where I can stash those folders when I don't want the brushes in them cluttering up my brushes menu. If I want to use some of these brushes, (say folder Sea_Monsters") I simply move the folder from "Not in Use" out to the "My_Brushes" folder, where it is already in the brush search path. (The lack of a folder's existance is not a problem for the brush search path.) Then I can "refresh brushes" and use them right away. If I hadn't already listed the folder user/automeris/Mapping/My_Brushes/Sea_Monsters in the brush search path, I would have had to restart the Gimp, or take those brushes out of their folder and put them elsewhere. Now I can put some undulating, scaled critters, maybe some flying fish, whatever I have there, into my oceans when I want them, but not have those brushes constantly visible.

(Actually, there is a better way to handle sea monsters and such, which I will address later if there is interest.)

04-27-2007, 03:43 PM
Holy Seaweed! Nice little tutorial there! Well done & thanks for sharing!

11-05-2007, 03:02 PM
Just a little update to this technique -

With the latest GIMP 2.4, there is a new feature that defines both a pen and a fill from whatever is in the clipboard!

This means that you don't have to save a bunch of brushes. Just create one source image that is a grid of all your textures, and set a grid that matches in GIMP.

Now just use the rectangular selection tool (snap to grid on) and CTRL-C on the texture you want. This can now be selected as a brush and painted or flood filled as a texture in the map image!

(I can give an example if this is not clear)

-Rob A>

11-05-2007, 03:12 PM
Some screenshots would be nice! (I don't use Gimp but maybe for others who do).


11-05-2007, 08:16 PM
Just joined and already providing that kind of valuable info? Have some rep!

(And welcome, of course)

11-06-2007, 11:59 AM
Here is an example of using GIMP 2.4 to simplify this technique...

I used a DC2 tileset downloaded from the DungeonForge web site. (You need membership to download the files there.) This one contains a bunch of dungeon elements in a 20px grid.

And Follow these instructions:

Hope that makes it clear!

-Rob A>