Tutorial: Using GIMP to create Top-Down tokens
Posted: Mon Feb 22, 2010 8:18 pm
I've begun a project involving making top-down tokens from photographed WotC miniatures for use in D&D, SW, and Pathfinder games (and I imagine many other systems could find them useful). I'll be making these as generally available as (legally) possible, but in the mean time I figured I'd put together a quick tutorial on using GIMP to extract a top-down token from an existing image file (whether it be a photograph you've taken, or an image you've pulled from somewhere else).
First, advice on strategies. If you're photographing minis, especially if you plan on keeping shadows, it'll help a lot of you have a solid background behind/under the thing you're photographing. This will make it easier to make the background transparent, and if it's white, it'll make it easier to get the shadow blended into transparency, rather than turning from black into a color that might stand out when you drop the image into MT. It is also going to be tempting to use images that are not straight down. This allows more detail, and is sometimes necessary. It's fine to a degree, but I find that if you use images that are too far off the y-axis they will not look right if you start rotating them on the map in MT, especially if you have all sorts of different images rotated at different angles. It can get visually very jarring. The only solution is to bite the bullet and stick as close to the vertical as possible. (Or never rotate your images.)
If you're interested in keeping shadows (and the tutorial below assumes this), I find that it's good to use fairly diffuse and weak ambient light, get in close with your camera, and use your flash. This will throw a pretty good shadow for ya, as the flash is not located precisely where the lens is, and at such distances the difference creates a significant angle.
Here's a typical .jpg image I might start with. (Figure is the Harbinger mini, Human Wanderer.) We begin by opening the file in GIMP. Go ahead and do a save-as to create a new file without overwriting the old one. If you plan on getting fancy and tweaking the image to get versions with different weapons and such, it's a good idea to save in GIMP's dedicated format, .XCF, which preserves all your various layers and such (see the - forthcoming - tutorial on manipulation of images like this for creation of a range of variations on a miniature's theme); when you've got the token as you want it, the .xcf, and then do a save-as to save the file to a MT-compatible file that preserves transparency. I use .png. (In GIMP, all you have to do is change the extension in the name of the save file and it will detect this and save to the proper format.)
So now the image is open. You should have a "Toolbox" window open, which holds the bulk of your brushes, color palettes, and selection/manipulation tools. Depending on your GIMP version (and what plugins you have installed) your toolbox and the contents of some of your menus will differ. This tutorial is based on GIMP version 2.6.7, but other version should not be too different if they're recent enough.
The first thing we want to do is start selecting the background, so we can get rid of it. Use this tool to select by color. Note that when you click to activate the tool, the lower half of your toolbox changes - this provides you with options for modifying how the tool currently selected works. Next to Mode you have options that allow you to select a new region, add to the currently selected region, subtract from it, or get an intersection. The 2nd and 3rd of these are going to be our focus. Click the second to add. (Though note if for some reason your whole image starts out selected, you will need to blank the selection first with cntl-shift-A (cntl-A selects all). GIMP will probably start with a "Threshold setting of 15, which is probably just fine. What this tool does is take whatever pixel you click on, find its color, and select all pixels in a continguous region of the image (or, more precisely, of the LAYER of the image you're on - but there's only 1 right now; see below). The color of the pixel doesn't have to be exact, though, and the threshold setting tells GIMP just how close they need to be. A smaller number will result in a smaller and probably rather chaotic selection. A larger number will have GIMP selecting way too much. We're just roughing in the image, so 15 should be fine if the background is relatively homogenous. If you are using and image with a more detailed background, the simplest thing to do is select the area around the image (make sure you include all shadows), and then press cntl-I, which "inverts" your selection, making what's currently selected unselected, and vice versa. Note: GIMP has a setting for "Feather edges". We're going to want hard edges here, so make sure that is NOT checked. Note also that if the tool is set to add to selection, if our first click doesn't get close enough, we can click further into our unselected area to inch closer. We should be left with something like this. What we're ultimately going to do to the selected area is turn it bone white simply hitting "delete" or using the bucket "Fill" tool set to fill with white. However, GIMP will often bleed white into the unselected area if you do this repeatedly, so while it may be helpful to you to clear the area right away, it's not a good idea to delete anything until the whole area is selected, allowing you to delete only once. In our example, we have something like this.
Now that the image is roughed in, we need to get in closer. The way I do this seems tedious, but once you get the hang of it it's really very quick. We're going to use the "Free Select" tool. This has its own Mode setting, so make sure it's set to add to the selection. (If you ever mess up here, or at any point, GIMP stores selection changes, so you can hit cntl-Z to undo your mistake.) In general you're going to want to zoom in pretty close to make sure you select just right. Go in and add in little bits all around the image until you have selected every bit of the image except the token and its shadow. It's best to err on the side of selected the edge of the token rather than leaving the background, as you'll notice a pixel or two of white around it more readily than a pixel of lost edge. Go ahead an leave a fair bit of the grayish fading shadow area, if you have it. You should wind up with something like this. Note: your selected area does not have to be contiguous, so you can go ahead and add in holes in the mini, say in the crook of an arm or a space created by a weapon, etc. When done, it should something like this. (Notice I've taken the chance to narrow the blades a bit, as these plastic minis often do not have an appropriately narrow blade.) Some of the details may not look right at this level zoom, but how often are you going to be zoomed this close in MT, right? Hit Delete to turn the selected area, including any irregularities in the background and any elements of the base of the miniature pure white.
First, advice on strategies. If you're photographing minis, especially if you plan on keeping shadows, it'll help a lot of you have a solid background behind/under the thing you're photographing. This will make it easier to make the background transparent, and if it's white, it'll make it easier to get the shadow blended into transparency, rather than turning from black into a color that might stand out when you drop the image into MT. It is also going to be tempting to use images that are not straight down. This allows more detail, and is sometimes necessary. It's fine to a degree, but I find that if you use images that are too far off the y-axis they will not look right if you start rotating them on the map in MT, especially if you have all sorts of different images rotated at different angles. It can get visually very jarring. The only solution is to bite the bullet and stick as close to the vertical as possible. (Or never rotate your images.)
If you're interested in keeping shadows (and the tutorial below assumes this), I find that it's good to use fairly diffuse and weak ambient light, get in close with your camera, and use your flash. This will throw a pretty good shadow for ya, as the flash is not located precisely where the lens is, and at such distances the difference creates a significant angle.
Here's a typical .jpg image I might start with. (Figure is the Harbinger mini, Human Wanderer.) We begin by opening the file in GIMP. Go ahead and do a save-as to create a new file without overwriting the old one. If you plan on getting fancy and tweaking the image to get versions with different weapons and such, it's a good idea to save in GIMP's dedicated format, .XCF, which preserves all your various layers and such (see the - forthcoming - tutorial on manipulation of images like this for creation of a range of variations on a miniature's theme); when you've got the token as you want it, the .xcf, and then do a save-as to save the file to a MT-compatible file that preserves transparency. I use .png. (In GIMP, all you have to do is change the extension in the name of the save file and it will detect this and save to the proper format.)
So now the image is open. You should have a "Toolbox" window open, which holds the bulk of your brushes, color palettes, and selection/manipulation tools. Depending on your GIMP version (and what plugins you have installed) your toolbox and the contents of some of your menus will differ. This tutorial is based on GIMP version 2.6.7, but other version should not be too different if they're recent enough.
The first thing we want to do is start selecting the background, so we can get rid of it. Use this tool to select by color. Note that when you click to activate the tool, the lower half of your toolbox changes - this provides you with options for modifying how the tool currently selected works. Next to Mode you have options that allow you to select a new region, add to the currently selected region, subtract from it, or get an intersection. The 2nd and 3rd of these are going to be our focus. Click the second to add. (Though note if for some reason your whole image starts out selected, you will need to blank the selection first with cntl-shift-A (cntl-A selects all). GIMP will probably start with a "Threshold setting of 15, which is probably just fine. What this tool does is take whatever pixel you click on, find its color, and select all pixels in a continguous region of the image (or, more precisely, of the LAYER of the image you're on - but there's only 1 right now; see below). The color of the pixel doesn't have to be exact, though, and the threshold setting tells GIMP just how close they need to be. A smaller number will result in a smaller and probably rather chaotic selection. A larger number will have GIMP selecting way too much. We're just roughing in the image, so 15 should be fine if the background is relatively homogenous. If you are using and image with a more detailed background, the simplest thing to do is select the area around the image (make sure you include all shadows), and then press cntl-I, which "inverts" your selection, making what's currently selected unselected, and vice versa. Note: GIMP has a setting for "Feather edges". We're going to want hard edges here, so make sure that is NOT checked. Note also that if the tool is set to add to selection, if our first click doesn't get close enough, we can click further into our unselected area to inch closer. We should be left with something like this. What we're ultimately going to do to the selected area is turn it bone white simply hitting "delete" or using the bucket "Fill" tool set to fill with white. However, GIMP will often bleed white into the unselected area if you do this repeatedly, so while it may be helpful to you to clear the area right away, it's not a good idea to delete anything until the whole area is selected, allowing you to delete only once. In our example, we have something like this.
Now that the image is roughed in, we need to get in closer. The way I do this seems tedious, but once you get the hang of it it's really very quick. We're going to use the "Free Select" tool. This has its own Mode setting, so make sure it's set to add to the selection. (If you ever mess up here, or at any point, GIMP stores selection changes, so you can hit cntl-Z to undo your mistake.) In general you're going to want to zoom in pretty close to make sure you select just right. Go in and add in little bits all around the image until you have selected every bit of the image except the token and its shadow. It's best to err on the side of selected the edge of the token rather than leaving the background, as you'll notice a pixel or two of white around it more readily than a pixel of lost edge. Go ahead an leave a fair bit of the grayish fading shadow area, if you have it. You should wind up with something like this. Note: your selected area does not have to be contiguous, so you can go ahead and add in holes in the mini, say in the crook of an arm or a space created by a weapon, etc. When done, it should something like this. (Notice I've taken the chance to narrow the blades a bit, as these plastic minis often do not have an appropriately narrow blade.) Some of the details may not look right at this level zoom, but how often are you going to be zoomed this close in MT, right? Hit Delete to turn the selected area, including any irregularities in the background and any elements of the base of the miniature pure white.