After a little trial and error, I've been able to use giftrans without too
much trouble. I use a couple of DOS batch files to make it a little easier,
though. The first one, GIFINFO.BAT, creates a text dump of a gif file and
loads it up in the DOS editor. Here it is:
-------------cut here----------------
@echo off
if "%1" == "" goto error
giftrans -L -e out.txt %1
edit out.txt
del out.txt
goto done
:error
echo Usage:
echo gifinfo filename.gif
pause
:done
-------------cut here----------------
The other batch file is TRANS.BAT. It accepts an input filename, an output
filename, and a color index:
-------------cut here----------------
@echo off
if "%1" == "" goto error
if "%2" == "" goto error
if "%3" == "" goto error
giftrans -T -b %3 -o %2 %1
goto done
:error
echo Usage:
echo trans source.gif output.gif colorNumber
pause
:done
-------------cut here----------------
The procedure for creating a transparent gif file is as follows:
- Use GIFINFO to locate the color index that you want to make transparent.
For example, if you want to make the RGB color 192,192,192 transparent,
you'd find the line in the gif "Global Color Table" that looks like this:
Color XX: Red 192, Green 192, Blue 192, #c0c0c0
The color index of this color is XX.
- Use TRANS to create the transparent gif. Here's an example:
trans in.gif out.gif XX
Greg Stumph
greg@pnwss.com