home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR16
/
GIF2TXT.ZIP
/
GIF2TXT.TXT
< prev
Wrap
Text File
|
1991-04-21
|
3KB
|
67 lines
GIF2TXT
GIF2TXT is a method for converting GIF images to ASCII text files. The
result can be displayed on a screen or sent to a printer. Most of the work
is done by PICLAB. (PICLAB.EXE lib 14 "Misc Util & Code" of PICS forum).
This package consists of 3 parts, a PICLAB script - GIF2TXT, a PICLAB MAP
file - CHR.MAP, and little program which inserts CR/LFs in the file from
PICLAB - CHRNL.EXE.
PICLAB is a self extracting archive so you just run it and it will produce
the executables and doc files. There are 2 EXEs: PL286 for 286 and up
machines and PL for the rest.
To perform the transformation do the following:
PL286 GIF2TXT <GIFfile> <TEXTfile> <width> <height>
(use PL for XT or similar machines)
A sample run for a full screen image (640 x 480 or 320 x 200 original) would
be:
PL286 GIF2TXT MYGIF MY.TXT 80 25
Before running GIF2TXT you need to figure out the size in characters of the
final text "image". For a standard screen display this is 80 x 25. If your
original is not the standard screen aspect ratio (1.333333) you will need to
compute a different size text file.
The "magic number" used in the calculation is:
(80 / 25) / 1.333333
This is: 2.4 in the following equations this will be refered to as MN.
First an example:
Lets say you have an image which is 350 x 480 and you want it to display on
a standard screen, thus you will use 25 as the height and you need to
compute the width.
width = (350 / 480) * 25 * 2.4
equals 44 , thus the text image is 44 x 25. If you know the hight (in
charcters) and you want to compute the width use:
char_width = (orig_width / orig_height) * char_height * MN
if you know the width you want and need to compute the height use this
equation:
char_height = ((orig_height / orig_width) * char_width) / MN
For example let's say you want to print the above image on a 80 character
wide printer, you know the width (80) but need to compute the height.
height = ((480 / 350) * 80 ) / 2.4
equals 46.
GIF2TXT works best with simple high contrast images. You will probably have
to play a bit with brightness and contrast to get good looking grayscales
from photgraphic type GIFs.
As it comes, GIF2TXT is designed for a usual CRT screen, black background
with white (or green or amber) characters. Since a printer prints black
characters on a white background, the image will be a negative of the
original GIF image. You can use the PICLAB command NEGATE to invert the
image before running through GIF2TXT if you will be sending the results to a
printer. The contrast and brightness adjustments will be different for a
printer than for the screen.