This page is deprecated. I discovered that gimp works ok with tga files - but not the tga files distributed with UFOAI TD1. If you want to use gimp on those files, you must first "fix" them using imagemagick, like this:
bash$ convert f_small.tga f_small.png bash$ convert f_small.png f_small.tga
The new f_small.tga file will work fine with both UFOAI TD1 and gimp.
I will leave this page up, because the techniques are still useful for separating the alpha or matte channel.
UFOAI uses targa format files (TGA) to store images which require an alpha channel. Unfortunately the GNU Image Manipulation Program (GIMP) does not handle tga alpha channels correctly. Therefore linux hackers who wish to work on the UFOAI menu system tga files (for instance, the fonts) must use a combination of GIMP (gimp.org) and imagemagick (imagemagick.org).
Imagemagick is a free (GPL), cross platform software suite to create, edit, and compose bitmap images. It is compatible with a wide variety of image formats. The imagemagick commands may be executed from the console.
I will illustrate with the example of how to modify the f_small.tga font file.
First, decompose the tga file into it's individual channels. We will save the channels as png files, because gimp handles png files well.
bash$ convert f_small.tga -channel R -separate f_small_red.png bash$ convert f_small.tga -channel G -separate f_small_green.png bash$ convert f_small.tga -channel B -separate f_small_blue.png bash$ convert f_small.tga -channel A -separate f_small_alpha.png
I converted all the channels for this example. A greyscale image represents each channel. Black represents zero and pure white represents the highest intensity value of that channel (255 for most four channel, four byte file formats). Even though I converted all four channels, I don't actually need all four files. My new font image will only be black and white therefore I only need to edit one file. I will use the f_small_alpha.png file.
bash$ cp f_small_alpha.png f_small_alpha_new.png
I will copy the alpha channel file to a new file for editing. Then I make my changes. Here's my new alpha file:
Now I combine the channels into a tga file using imagemagick:
bash$ convert f_small_red.png f_small_green.png f_small_blue.png \ f_small_alpha_new.png -channel RGBA -combine f_small_new.tga
And I can copy the f_smal_new.tga file to base/pics/f_small.tga. Play the game and the numbers should look different.
Now I want the new numbers to look red instead of white. Convert the new numbers file to a png file
bash$ convert f_small_new.tga f_small_new.png
Open the f_small_new.png file in the gimp. Now select the Layers menu, the Colours menuitem, and the Levels... submenuitem. The levels dialogue appears. In the channel dropdown box, select the Green channel. Using the slider set the value to zero. Do the same for the blue channel. Here's a screenshot:
Then save the image as f_small_new_red.png. On the command line, convert this png file to tga using imagemagick, and copy it to base/pics/.
bash$ convert f_small_new_red.png f_small_new_red.tga bash$ cp f_small_new_red.tga ~/ufoai_td1/base/pics/f_small.tga
Voila! Red letters!