OS/2 eZine - http://www.os2ezine.com
Spacer
August 16, 2004
 
AL du Pisani is a South African, working at a large financial institution, where he looks after their Lotus Notes environment. He has been using computers off and an for the past twenty years. His first exposure to OS/2 was with 2.11. It is still the preferred environment, and is what he runs at home. He is also a fan of Science Fiction.
If you have a comment about the content of this article, please feel free to vent in the OS/2 e-Zine discussion forums.

There is also a Printer Friendly version of this page.



Spacer
Previous Article
Home
Next Article


WarpFX


Gif_Text: Turning text into images

While working on redeveloping my web site, I found the need to turn some text into an image. I remembered that I looked at this tool once before, and decided to look at it again. It did what I wanted.


Gif_Text

Gif_Text is a program written originally as an add on to the SRE-HTTP server, to turn text to image on the fly. It was developed further, and part of it was turned into a stand alone command line program.

It is coded in REXX, and makes use of RexxGD to generate the images. Gif_Text have been stable for a couple of years, and can only generate images in GIF format.

RexxGD is still under development, but activity seems to be slow. Newer versions have lost the ability to generate GIF images, [Editor: Probably due to the whole Unisys GIF patent fiasco?] but gained the ability to generate JPEG and PNG images.

The newest version of Gif_Text is 1.3c, and the version on the SRE-HTTP web site is slightly newer and faster than the version on Hobbes. (Which have the same version number)

As a SRE-HTTP addon it also have additional functionality, such as the ablilty to generate graphical buttons for your web page.

Installation

Installation consists of unziping the file into a directory, copying the RexxGD DLL to a place in your PATH, and unziping the ALPHABYTE file.

Please read the supplied documentation, in the file GIF_TEXT.DOC, as you do need to change a couple of parameters in the Gif_Text.cmd file, and the documentation explains where and to what you need to change things.

The ALPHABYTE file contains button backgrounds, backgrounds, colour slides and alphabyte images.

An Alphabyte image is an image or collection of images which contains a graphical representation of the alphabet, to be used in generating the images.

Use

At it's most basic, generating a new image boils down to executing the Gif_Text command, answering the neccessary questions on backgrounds, colour bars and alphabyte sets, entering the text you wish to turn to an image, and giving the output file name.

Annotated example session

GIF_TEXT (ver 1.3c): a text-to-gif utility -- command line mode
Although designed primarily for use as a WWW script, you can use
GIF_TEXT to create .GIF files in a stand-alone mode.
GIF_TEXT does not have graphics display capability
... but you can invoke your browser (or other graphics
program) to view .GIF files generated by GIF_text..
Are you ready to continue   Yes\No  :y
{If you answer No here, you are dumped back to the command line}
... reading prior options from GIF_TEXT.ANS
{Your answers of the previous session are saved into the GIF_TEXT.ANS file. This is helpfull if you are tweaking a generated image, and are only planning on changing one element at a time}
Would you like to view GIF_TEXT.DOC ?  Yes\No  :n
On the other hand, you can always learn by making misteaks ....
{This is the main Gif_Text documentation. Please read at least once, before using the program. Once you have read it and are familiar with the program, this line just become an irritant.}
What  alphabyte font  do you want to use (?=list,ENTER=WOODBLOCK):
{In the previous session my answer was WOODBLOCK. By default your previous answer is the default answer for the new session. In this specific case I entered "?", and got a list of available alphabytes.}
List of alphabytes & fonts
agate      andy01     andy02     andy03     andy04     antelope
backs      bck        buttons    buttrfly   Carolyn2   Carolyn3
Carolyn8   courier    Delft      enviro     epilog     epilog2
fresnel    fuzgreen   ghosty     greyred    handwrit   hobo
Jurasic    logger     mandarin   Neon       purpwhit   revue
slides     stich      twoturt    warpsans   woodblock
{Here is the list of alphabytes and fonts available on my computer. Since I have extended the alphabytes, there are more items on my list that you would find on your setup.}
What  alphabyte font  do you want to use (?=list,ENTER=WOODBLOCK):fuzgreen
{Selecting the alphabyte font FUZGREEN. You have to type this out, no way to select from the list of what is avaiable}
Background file (0=None, ?=list, Enter=0):
{I selected to have no background image.}
Color slide (0=None, ?=list, ENTER=0):
{A color slide is an image about 1 pixel high, comprising a colour bar. When you select this, your alphabyte or font's natural colour is overwritten with the slide's colour. Once again I chose not to make use of this ability}
Height (in pixels), 0=automatic, ENTER=240:
Width (in pixels), 0=automatic ENTER=0:
{You need to enter either the height, width or both of the image you want to generate. In my case I entered the height, and told the program to calculate the width. This is the total height of the image, not of any individual line of text.}
Enter your message   ($d=date, $t=time, $n=newline, $f(fontname)=font switch
(ENTER=   Science+Fiction$nSouth+Africa   )
The message:
{This is the tricky part. As you can see from my answer, I wanted a two line image, and I had to specify where the line break is. If you do not specify a line break, the program will generate a single line image. The program substituted + signs for spaces. Do not do that yourself, as some alphabytes and fonts can print the plus signs.}
Additional options (0=none,? for help, * xx = add xx to prior options
ENTER=prior options=  LINE_J
?
Using options:  LINE_J
{Another tricky part. I wanted the lines justified, that is, to have each of the two lines centered on it's line. Other line justification options are also available. Other optins, such as whether to tile the background image or not, are also available. This will be highly dependant on what you are trying to accomplish.}
Enter output file name (ENTER=SFSA_FG.GIF):
{Enter your output file name.}
GIF_TEXT: completed image of size  480  x  240
SFSA_FG.GIF  created (length = 22718
{Notification that the image have been generated}
Display this image using NETSCAPE -l en   Yes\No  :n
{Default display program is Netscape. You can (and probably should) change this to something else. I chose not to display this now, and looked at it later with PMView}

Extending Gif_Text

Extending Gif_Text can range from easy to difficult. The easy parts to extend are the backgrounds and colour slides. All you need to do there is to copy the new backgound or colour slide into the relevant directory.

To extend the alphabytes are a bit more difficult. There are two ways to do so: Convert a font into an alphabyte, and create a new alphabyte.

I have not tried converting a font, but found it possible to create a new alphabyte.

First, get a source of images of letters, one for each character you wish to make part of your alphabyte.

Create a new directory under your alphabyte directory, and add all the letters to it.

Now create a new alphabyteName.IND file for the alphabytes. You most likely will end up copying an existing one across and modify it to reflect your character set and names of letters.

Test your new alphabyte by creating a new image.

Resources

Download Gif_Text at http://www.srehttp.org/distrib/gif_text.zip

Previous Article
Home
Next Article

Copyright (C) 2004. All Rights Reserved.