Andrew Gaffney wrote:

> I want to write a Perl program that will auto generate GIF images. The images that I 
> want
> to generate will be about 30x80. It will be a black rectangle starting in the 
> bottom-right
> with a few pixels border on the top and left. There will be a light blue rectangle
> starting in the top-left with a few pixels border on the bottom and right. There 
> will then
> be 6- or 8-point black bold centered text that will be specified when the program is 
> run.
> The background also need to be transparent. Can anyone give me any pointers on 
> writing a
> Perl program that can do what I need? Links to examples are good too. Thanks.
>
> --
> Andrew Gaffney

Is this production work?  If so, use a module.  Perl has a pretty wide choice in 
graphics
modules, and Daniel provided a good starting point in his response above.  If you are
interested in hand-cracking this, the best place to start is with the GIF links on 
this page:
http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html
They are very links to the best, primary-source, information on GIFfery.  The three 
links
include the original specifications for both versions 87a and 89a, as well as an essay 
on the
compression and decompression algorithms.

Some tips if you do take the hand-crank route:

1.  Be aware that the marketbility of any product you make could be problematic.  In 
many
nations, Unisys Corp. still holds and asserts a patent on LZW compression.  They held 
a patent
in the USA until June of this year, when it expired.
***!!!  Yippeee  !!!****
So there may be licensing issues if you distribute outside the USA, or are located in a
country where the patent is in effect.

2.  Start with images that come out under 254 bytes compressed.  It sounds like your
anticipated use will fit well under that.  There are some rollover issues that arise 
when you
start new coding chains within an image, so its better to get the coding working on 
smaller
images, then work up to deal with the "where is the start of this next coding segment?"
issues.

3.  Make objects to represent the various types of blocks within a structure.  This 
will make
each more modular and allow for better self-management.  Some blocks are optional, 
others are
version-specific, others may exist or not based on the value of a flag in the 
descriptors.
You will want to be ready for interpreting each block as it comes, and keep the 
interfaces
between you functions and objects very clean.  It is all too easy to slip by a few 
bits and
totally hose the encoding/decoding.

Good luck.

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to