TeamColoring

From The Battle for Wesnoth Wiki
Revision as of 04:23, 17 September 2009 by Solsword (talk | contribs) (Instructions for using the built-in teamcoloring script.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If you're an artist, or if you want to use a Wesnoth sprite as your avatar in the forums, or for whatever reason you want to produce a team-colored copy of a Wesnoth sprite without actually running Wesnoth (and probably having to cut the sprite out of a background), there are two easy tools to accomplish this:

  • TeamColorizer - This is a Python script included with Wesnoth that does an inaccurate teamcoloring: it uses a slightly different algorithm than the one used in-game. However, it allows you to use any color that you want, even colors that aren't normal team colors. You just need to do a bit of trickery.
  • wesnoth-tc - This is a C++ program, written by Shadowmaster from the forums. It even has a GUI written for Macs. It uses the same algorithm as the Wesnoth engine.

TeamColorizer

The TeamColorizer included with Wesnoth is at data/core/tools/unit_tree/TeamColorizer. Internally, it's used to produce the red sprites found on http://units.wesnoth.org. However, you can use it to color any image red. It's a command-line program, so first you'll need to open up a command line (either Start->Run and then type "cmd" in Windows, or use Terminal on a Mac; if you run something else you should know how to do this already). Next, you need to find two things: Python, and the TeamColorizer. You don't have to do this in the shell. Python is likely to be at

C:\Python<#>\Python.exe

or something like that, where <#> is the version, and will be something like '25' for 2.5, '26' for 2.6, etc. You actually don't need this step on a Mac. Next, you have to find the TeamColorizer, and this one you have to do in the shell, by typing

cd <directory>

and then either 'ls' or 'dir' depending on whether you're on Windows ('dir') or on something else. The directory you want is data/core/tools/unit_tree relative to the Wesnoth data directory. Once you're there, type

python TeamColorizer -h

and press enter. The program should print a help message, giving you instructions, follow these, and you can get teamcolored images. If the instructions are difficult to follow: You'll wind up using a command like

python TeamColorizer --color=red my_image.png output_image.png

If you don't want to worry about where the images are, you can just copy the image you want to use into the same directory as the TeamColorizer for simplicity. Note that the output image will also appear in the same directory as the TeamColorizer. If you want, you can copy the TeamColorizer somewhere else for convenience.

Note: these are pretty bad and technical instructions... especially the Windows side. Please revise them if you've got a better way of explaining things. Maybe you could just create a shortcut with the arguments in it in Windows and that would be simpler?

Note 2: On a Mac or other Unix machine, you should be able to use

./TeamColorizer ...

in place of

python TeamColorizer ...

and for those happy to deal with paths a lot, there's no reason not to do

./path/to/teamcolorizer/TeamColorizer ...

wesnoth-tc

If you want to use wesnoth-tc, read up on it on its forum thread. The thread has information on usage and a link to download the source, as well as information on the Mac GUI. Feel free to post more instructions here if you use it and feel like sharing any insights you gain.