tgd

A text based tool for creating and manipulating GIF images

Provides shell level access to the gd 1.1.1 graphics library


Preface

tgd reads text files and writes GIF files. It was born out of my desire to learn the gd 1.1.1 graphics library and Perl simultaneously, I hope that it will allow me to make new tools available on the World-Wide Web to help molecular biologists cope with ever increasing quantities of data. The latest version of the documentation should be available at http://s27w007.pswfs.gov/tgd/tgd.html .

Credits & Rights

This program would not exist if Doug Bigwood had not shown Thomas Boutell's gd 1.1.1 graphics library to me. To appreciate tgd you must read Boutell's documentation. You can find the Credits and License terms of the gd 1.1.1 library at gd.html#notice or in the tgd distribution. Thanks to Sam Cartinhour for additional fonts.

We place no further restrictions on distribution of the source code other than those attached to the software from which it is derived except to request that novel software derived from tgd include credit to the Dendrome project , Institute of Forest Genetics, USDA Forest Service.

The Dendrome project is funded by the USDA ARS Plant Genome Research Program and by the USDA Forest Service .

tgd was written by Bradley K. Sherman . Please drop me a line to let me know you're using it, and send bug reports and comments to [email protected] .


Table of Contents


Where do I get tgd

Anonymous ftp to s27w007.pswfs.gov/pub/tgd as tar'ed compress'ed file tgd0.tar.Z (400K) or tar'ed gzip'ed tgd0.tar.gz .

How do I build tgd?

tgd is written in the same crufty C as gd1.1.1. It should be possible under *ix to:
  % uncompress tgd0.tar.Z
  % tar xvf tgd0.tar
  % cd tgd0
  % make
But this is tested only on a Sun. You may need to fiddle with the Makefiles either in tgd0, or in tgd0/gd1.1.1.

tgd basics

The general idea is that tgd consumes files consisting of lines. Each non-blank non-comment line begins with a tgd command. tgd can be invoked with a list of files as argumemts
 % tgd file_a file_b file_c ...
or it can be used as the tail end of a pipe
 % perl -e myPerlscript | tgd
Limits on the tgd input file
When an image file is read from disk colornames are assigned to each color in the file. The names are are made from a template "#XXXXXX", so tgd assigns #000000 to a color with r,g,b values 0,0,0 and #FF00FF to a color with r,g,b values 255,0,255.

tgd Commands

Commands are case-insensitive. With the exceptions of: the gd 1.1.1 function underlying tgd function foo is named gdImageFoo Thus the documentation for gd 1.1.1 function gdImageFillToBorder applies to tgd command filltoborder .

Fonts

Font names are case-sensitive.

Examples

Here's a simple text file called helloworld.txt:
    create myimage 200 100
    colorallocate myimage white 255 255 255
    colorallocate myimage black 0 0 0
    string myimage gdFontLarge 40 40 "hello, world!" black
    gif myimage helloworld.gif
tgd can be used to turn this into a gif. E.g. using a Unix shell:
% tgd helloworld.txt
creates this image:

Here's the output of a short Perl script called rainbow.pl which when invoked like this

rainbow.pl | tgd
creates:

Here's a Perl script called gifcap.pl And we can add a caption to rainbow.gif using the script in this manner:

gifcap.pl rainbow.gif cap.gif 14 "Rainbow Gif by bks" 255:0:0 0:0:255

which produces:

Here's a simple demonstration script called keypad.pl which reads a set of 12 labels and corresponding URL's from an input file and creates: