Re: Transparent GIFS

by "Robin S. Socha" <r.socha(at)control-risks.de>

 Date:  20 Jun 1998 12:29:26 +0200
 To:  hwg-graphics(at)hwg.org
 References:  hwg
  todo: View Thread, Original
* Virginia Blalock <skatefan(at)usa.net> writes:

> Is there any way I can make transparent GIFS in a mass manner, like
> say choose x number of graphics and tell a program to make them
> transparent?

Hi, Virginia,

Got access to a U*ix system? Then this Dirty Hack(tm) will do the
trick. The script will crawl through your image tree and convert the
colour you specify as TRANSPARENT_COLOUR with ... errr ... nothing?
Usage: transgif "#ffffff" to make all whites transparent. Errors will
be logged in transgif.err

================================= 8< ================================
#! /bin/sh
# transgif (Use giftrans to batch process all gifs in a tree, making
# one colour transparent) (c) Robin "hangoveR." Socha 1998
DOC_ROOT=""
TRANSPARENT_COLOUR=$1
for i in `find $DOC_ROOT *gif`       
do 
giftrans -t $TRANSPARENT_COLOUR $i -e transgif.err -o $i.tmp
mv $i.tmp $i
echo "Look, Ma, $1 in $i has gone..."
done
================================= 8< ================================

The documentation for giftrans:

================================= 8< ================================
Usage: giftrans [-t color|-T] [-B color] [-b color] [-g
oldcolor=newcolor] [-c comment|-C] [-l|-L|-V] [-o filename] [-e
filename] [filename] 

Convert any GIF file into a GIF89a, with the following changes possible:
-t Specify the transparent color
-T Index of the transparent color is the background color index
-B Specify the transparent color's new value
-b Specify the background color
-g Change a color in the global color table
-c Add a comment
-C Remove old comment
-l Only list the color table
-L Verbose output of GIFs contents
-V Verbose output while converting
-o Redirect stdout to a file
-e Redirect stderr to a file
Colors may be specified as index, as rgb.txt entry or in the #rrggbb
form.
================================= 8< ================================

You could, of course, get yourself an RSI trying to click together a
PhotoShop macro instead. ]:-> But who needs commercial apps in the age
of Linux and other free software?

Ro"wherestheaspirin"bin

-- 
Robin S. Socha M.A. 
Control Risks Ltd. <http://www.crg.com/>

HWG: hwg-graphics mailing list archives, maintained by Webmasters @ IWA