From tusol.cs.trinity.edu!swrinde!howland.reston.ans.net!pipex!uknet!festival!dcs.ed.ac.uk!epcc.ed.ac.uk!gordonc Sat Jan 28 22:17:07 1995
Newsgroups: comp.graphics
Path: tusol.cs.trinity.edu!swrinde!howland.reston.ans.net!pipex!uknet!festival!dcs.ed.ac.uk!epcc.ed.ac.uk!gordonc
From: gordonc@epcc.ed.ac.uk (Gordon D B Cameron)
Subject: Re: Netscape Gif Pixel Transparent flag
Message-ID: <D355FK.GnJ@dcs.ed.ac.uk>
Sender: cnews@dcs.ed.ac.uk (UseNet News Admin)
Organization: Edinburgh Parallel Computing Centre
References:  <3g9itt$b09@usenet.rpi.edu>
Date: Sun, 29 Jan 1995 00:30:55 GMT
Lines: 71

In article <3g9itt$b09@usenet.rpi.edu>, mabusj@vccnorth22.its.rpi.edu (Jasen M. Mabus) writes:
> Dear WWW users,
> 	Is there a package to change a white gif background into a transparent color? I have seen this done with a Graphic Control Extension.
> Jasen Mabus (http://www.rpi.edu/~mabusj)
> 

If you have the PBMplus toolkit, then just convert to ppm, then back to
GIF, using the right flags - you can change the GIF to be interlaced
like this also.

If you have PERL or similar, you could use something like the wee prog
below, which I use for this type of purpose :

#!/usr/local/bin/perl -s
#
#
# Take a gif file, and make it transparent, using the supplied colour
# 
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#
# VIDEO TOOLS - VERSION 1.0
#
# Gordon Cameron (gordonc@epcc.ed.ac.uk)
# Edinburgh Parallel Computing Centre
#
# Web Video Pages : http://www.epcc.ed.ac.uk/~gordonc/video_tools/intro.html
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

$tran_colour="white" ;			# Default transparent colour
$to_ppm="giftopnm";			# Converter from GIF -> PPM
$from_ppm="ppmtogif";			# Converter from PPM -> GIF

($my_name) = $0 =~ /([^\/]+)$/ ; # Get rid of slash nonsense at head of name

if ($h || $help || (@ARGV>1)) {
	print <<"EOHELP" ;
	Usage : $my_name <colour_specification>

	Takes a GIF as standard input, and produces a GIF89A as standard
	output, with the colour <colour_specification> made transparent in
	the output GIF. The colour can be specified by an X name, or
	by an R,G,B triple, where R, G and B are between 0 and 1.

	e.g.
		$my_name <in.gif 0,0,0 > out.gif
		$my_name <in.gif white > out.gif

EOHELP

	exit 1 ;
}


$tran_colour = $ARGV[0]
	if (@ARGV); 

open(PIPE,"|$to_ppm|$from_ppm -interlace -transparent $tran_colour") ;

while (<STDIN>) {
	print PIPE ;
}

close(PIPE) ;


-- 
~ Gordon Cameron (gordonc@epcc.ed.ac.uk)      ~  The rain in Spain, 
~ Edinburgh ||>arallel Computing Centre (EPCC) ~  falls mainly on the plain
~ __________||_____Tel (+44) 31 650 5024______  ~  whereas the rain in Scotland
~ http://www.epcc.ed.ac.uk/~gordonc/intro.html	 ~  falls, mainly

