GIF manipulation in PERL and in C

GIF manipulation in PERL and in C

Post by Luca Told » Tue, 21 Mar 1995 21:22:56



Target: Perl Graphics library for fast GIF creation

References: (1)- gd1.1.1   C graphics library for fast GIF creation
                           (http://siva.cshl.org/gd/gd.html)
                            by Thomas Boutell

            (2)- gif.pl    Perl routines to create GIFs
                           (http://www.omron.co.jp/~jfriedl/perl/gif.pl)
                            by Jeffrey Friedl

            (3)- WebCrowler Search for Perl and GIF on the WWW
                 (http://webcrawler.cs.washington.edu/WebCrawler/WebQuery.html)
                            by

            (4)- WAIS search on comp.lang.perl
                            (wais://archive.orst.edu:9000/comp.lang.perl)
                            by Bill Middleton

Dear Collegues,
I need to be able to read/write/modify GIF files using Perl.

(1) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I have recently found the gd1.1.1 C graphics library written by
Thomas Boutell (ref 1), of great value.

"It allows your code to quickly draw images complete with lines,
arcs, text, multiple colors, cut and paste from other images, and flood
fills, and write out the results as a .GIF files. This is particularly useful
in World WIde Web applications, where .GIF is the format used for inline
images"

Unfortunately it is written in C and although I am aware (FAQ 2.19) that
is possible to link C with Perl (man perlapi), I find the latter step rather
discouraging.
(2) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The only Perl package that I could find which address the problem of
manipulating GIF files is the one written by  Jeffrey Friedl (ref 2).
"BLURB:
 Routines to create monochrome (and possibly transparent) gifs.

 Three public routines:

 gif'start(FH, w, h, R, G, B, r, g, b, transparent)
    Prepare to write a stream of bits to the named file handle (as a string).
    The W and h are the width and height of the image.
    The first R G B are for the foreground, the 2nd for the background.
    If $transparent is fiven and is true, the GIF89a "transparent color"
    will be used for the background (otherwise it's a GIF87a)

 gif'bits(text...)
    Text should be a string (or strings) of 0s and/or 1s which are
    taken as background and/or foreground bits of the image.

 gif'end()
    Finalizes things."

These three routines are extremely valuable but unfortunately do not allow
to perform the tasks  of drawing lines of defined colors from a point to another
and to insert text strings, in a straightforward way.
(3) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Scanning the Webcrower (ref 3) with the keys GIF perl produced a list
of entries linked all to the statistics pages of various sites, due to the
fact that "...wwwstat is a Perl tool that allows the creation of GIFs with the
help of gwstat (a C program) analyzing the log files ..."

(4) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I have tried the WAIS search on the comp.lang.perl(ref 4) but that failed.
Is it really maintained ?

=============================================================================
With this long article (that perhaps may be useful to others interested
on the topic of GIF manipulation in perl or C) I would like to conclude
asking for Perl packages that perform as easily as for gd1.1.1 and that are
available on Internet ...

Looking forward your contribution
Best Regards
Luca Ida Giovanni Toldo (Ph.D.)
European Molecular Biology Laboratory
Computer Group
Heidelberg
Germany


       url:        http://www.embl-heidelberg.de/~toldo/

 
 
 

GIF manipulation in PERL and in C

Post by Wm. Randolph U Frankl » Tue, 28 Mar 1995 10:30:01



  > I need to be able to read/write/modify GIF files using Perl.

So far as I know, Perl is interpreted, and it stores numbers as
character strings, converting them back and forth when used.  This
makes it rather unsuitable for massive numerical calculations.  I
started to write some array manipulation programs in Perl, but
converted to C after I timed the act of merely reading in a
600x600 PGM file w/o any processing.

I know that your time may be more important than the machine's
time, but there are limits, and we're talking orders of magnitude
here.

Perl 5 may be better.  Dunno.

------------------------

 ECSE Dept., 6026 JEC, Rensselaer Polytechnic Inst, Troy NY, 12180 USA