home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
gif
/
gif2wp32.arc
/
GIF2WPG.DOC
next >
Wrap
Text File
|
1988-12-13
|
12KB
|
304 lines
GIF2WPG V3.2 GIF -to- Word Perfect Graphics File Translator
Copyright 1988 by William J. Hinkle [71121,3211]
13 Dec 1988
GIF and 'Graphics Interchange Format' are trademarks of
CompuServe, Incorporated.
an H&R Block Company
=== User's Guide ===
The GIF2WPG program was created to allow graphics files created as GIF
(Graphics Interchange Format) files to be used in Word Perfect documents.
To do this, the program translates the GIF file into a WPG bit-mapped
raster graphics file. In the process, GIF2WPG converts the GIF image's
colors into shades of gray, which it tries to reproduce in the WPG image.
There are zillions of GIF files available on CompuServe in the QPICS
and GALLERY forum, as well in other forums, and from other sources.
Generally they are in color, which GIF2WPG changes into grayscale and then
dithers (default) or halftones.
The translator is a single file: GIF2WPG.EXE.
THE CATCH
=========
Note that this program is being released by the author, and is NOT supported
by Word Perfect Corporation, or by CompuServe Inc.
It is NOT public domain!
In fact, if you use this utility extensively, the author will be glad to
accept your contribution of $10.00 to offset costs of developing this program.
If you use GIF2WPG in a commercial or business environment, please consider
this imperative. Please see the very end of this document for details!
OPERATION
=========
First get a GIF file contains the graphics image you want to integrate into
your document. These are usually "paint" or "screen capture" images. See
GO PICS on CompuServe. It should have the standard .GIF file extension
(i.e., fname.GIF).
To create a .WPG file, type in:
GIF2WPG fname
or
GIF2WPG fname.GIF
or
GIF2WPG fname.GIF fname.WPG
from the DOS command prompt. The .GIF extension is assumed if you do not
specify one. The .WPG extension is assumed whether you specify one or not.
The .WPG file name is made the same as the .GIF if not otherwise specified.
Full DOS pathnames can be specified. You can specify just a directory
(ending in \) or a drive (ending in :) instead of the second filename; the
WPG file will use the name of the GIF file, with a WPG extension, and be
placed on that path.
The .GIF file will be translated to a .WPG file.
The .GIF file will not be erased. You can also specify scaling factors, but
the defaults often work the best (see below).
Some GIF files are "interlaced" -- they are specially constructed for on-line
viewing. GIF2WPG can only process this type of GIF file if you specify the
/hN or /dN options, where N is a decimal number. See below for details.
You'll get an error message mentioning this fact if you try to translate such
a GIF file with the default settings.
COMPLEAT USAGE
==============
If you invoke GIF2WPG from DOS without any other parameters, it will
display the following help message. This illustrates some of the
other options:
-----
GIF-to-WPG Translator: V3.2 ... Copyright 1988 by W.J.Hinkle
Press a key to get a little help...
(You press a key here!)
Usage: GIFWPG fname1 [fname2] [option] [option] ...
where: fname1.GIF ... GIF format input file
fname2.WPG ... Word Perfect WPG file (default is fname1.WPG)
/iN ... option: select sub-image N (default is 1)
/xN ... option: x density = N pixels-per-inch
/yN ... option: y density = N lines-per-inch
/v ... option: reverse video
/hN ... option: force halftone block to NxN
/dN ... option: force dither block to NxN (<=0 =error diffused)
/cN ... option: change contrast by N%
/l ... option: linearize colors (ignore color maps)
/g ... option: equal color weighting for grayscale GIF
/p ... option: print pixel histogram data
Press a key to continue...
(You press a key here, too...)
GIFWPG is a translator from CompuServe GIF files to Word Perfect WPG
graphics files.
The GIF colors are converted to grayscale intensity using the weighting:
Red 30%, Green 59%, Blue 11%. You can specify that the GIF uses only gray
tones with the /g flag; equal color weighting will then be used.
The grayscale is dithered error diffused, by default. A pattern block
size can be used instead: select with /dN, N=1,2,4 or 8 for pattern dither
or with /hN, N=1,2,3 or 4 for pattern halftone.
The X density defaults to 100 pixels-per-inch times the halftone block
size (if any). The Y density is set for 4/3 aspect ratio, unless set by
use of the /xN and /yN options.
GIF and 'Graphics Interchange Format' are trademarks of CompuServe Inc.
By: William J. Hinkle, CIS [71121,3211]
-----
If your GIF file contains multiple sub-images, you can specify which one
to extract and translate by specifying the /iN option, where N is the sub-
image number 1,2,3... etc. Normally, you can ignore this option; the 1st
(or only!) image will be translated. If there are additional sub-images
beyond the one selected, a warning is issued and they are ignored.
Normally GIF2WPG decides that the image's X density (for width) is
100 pixels (or lines) per inch, times the halftone block size (see below).
The Y density (for height) is set by by computing the density required to
create a 4/3 aspect ratio in order to simulate a CRT screen. This is done
because most GIF images are a single full screen image. This allows
computation of a "natural" size for the graphics image.
You can specify a different density by specifying the /xN option switch (e.g.
/x300 is 300 pixels per inch horizontally). The corresponding Y density is
computed as above. You can also alter the aspect ratio by specifying both
the /x and /y option switches, with different density values. The overrides
are NOT further adjusted for halftoning or error-diffused multiplication!
Most GIF files are in color. GIF2WPG transforms the color mapping into
intensity of grayscale using the above mentioned weights. If you know for
a fact that the GIF uses gray tones only, you can specify the /g option to
use equal color weights.
Once in grayscale, the image can be either dithered (the default) or
halftoned.
Dithering tries to average the image brightness over a small area of the
image. The default is to use double the size of the image in both axes,
and use error-diffused dithering. You can vary the multiplication factor
by specifying the /dN option with a negative N, where N is the size multiplier.
In other words, the default dithering is equivalent to /d-2. This type of
dithering tends to ease problems image artifacts if you later scale the image.
If you specify the /dN option with positive N (/d1, /d2, /d4, or /d8), the
image size is not multiplied and a patterned dither is used with an NxN
dither block. This can give smaller WPG files, but not very good visual
results.
A better option is halftoning, which replaces each GIF pixel with a block of
on/off pixels that have a corresponding optical density. Halftoning will be
done instead of dithering if you specify the /hN option (which will halftone
with an NxN block). For example: /h1, /h2, /h3, or /h4.
Normally GIF2WPG flips the photometric interpretation of the GIF file colors:
the brightest colors have the fewest pixels in the WPG file. This is because
GIF files are generally optimized for screen viewing, but Word Perfect will
(eventually) put the image on paper. However, if you want a reverse video
effect, use the /v option switch.
You can override the GIF file's color map by specifying the /l option (that's
an "el", not a "one"). This "linearizes" the color mapping: color indices
will be transformed directly into grayscale without worrying about how
bright the colors really ought to be. This sometimes gives a more detailed,
though probably less accurate, image. It may be most useful for charts
and such.
The /cN option can be specified to crudely adjust the contrast of the image
before halftoning or dithering. The effect is to multiply each grayscale
intensity value by N%. The factor N can be greater or less than 100. If not
specified, the contrast is left at 100%. For example: /c85 give 85% contrast.
The /p option causes a histogram to be kept on the distribution of color
indices in the GIF image. The RGB levels and relative brightness of each
color, as well as the number of occurences of each value, are printed on
the screen when the translation is complete. This can sometimes be helpful
in adjusting the /cN contrast option.
EXAMPLES
========
1) Suppose you have a GIF file called "earthm.gif". You want to create a WPG
file version of this image without worrying about the details. You can
translate this to a WPG file by typing (at the DOS prompt):
GIF2WPG earthm
and you will see something like:
-----
GIF-to-WPG Translator: V3.2 ... Copyright 1988 by W.J.Hinkle
From GIF 640x350x16 file: earthm.gif
to WPG 1280x700 file: earthm.WPG
dithered error diffused with 100% contrast.
"Natural" picture size is 6.400W x 4.800H inches.
-----
Note that both the GIF image resolution and color range are shown:
GIF Width x Height x # of Colors
Also shown is the final WPG image resolution:
WPG Width x Height
Also shown are the "natural" size of the final image, and the file names.
2) Suppose you have a GIF file called "yikes.gif". You can translate
this to a WPG file by typing (at the DOS prompt):
GIF2WPG yikes /h4
and you will see something like:
-----
GIF-to-WPG Translator: V3.2 ... Copyright 1988 by W.J.Hinkle
From GIF 156x131x16 file: yikes.gif
to WPG 624x524 file: yikes.WPG
halftoned into a 4x4 pixel matrix with 100% contrast.
"Natural" picture size is 1.560W x 1.170H inches.
-----
CAVEAT
======
Should you have any difficulties using this program, you can contact
me through CompuServe EMAIL to [71121,3211], if you like, or at the address
below. General feedback is welcome, especially on better methods of color
reduction, grayscale halftoning and dithering, and problem GIF files.
Thanks to Bob Cancilla [76077,354] for his prototype testing & help on
the original GIF2BIT for Lotus Manuscript.
Thanks to Jeff Lewis [72717,1033] for ideas on halftoning and dithering.
Thanks to Kyle Powell [76044,2215] for his public domain LZW decoder 85GIF.
Thanks to Floyd & Steinberg for the error diffused dither algorithm.
Thanks to the many CIS beta testers and folks who reported problems.
REVISION INFO
=============
* Version number Date Explanation *
* -------------- ------ -------------------------- *
* 3.0 14 Oct 88 Original Release, based on GIF2BIT V3.0 *
* 3.1 21 Nov 88 Added color map & output attributes *
* 3.2 13 Dec 88 fixed row decoding problem where there *
* was more rows encoded than the GIF *
* header indicated. *
* Also added /g option (grayscale weight) *
COPYRIGHT INFO
==============
This program GIF2WPG.EXE was written by
William J. Hinkle
who retains the copyright. All rights are reserved, except as follows.
Copy and use GIF2WPG.EXE and GIF2WPG.DOC freely. Distribute it to whomever
you want. But:
=== DO NOT distribute modified versions.
=== DO NOT remove the copyright notice.
=== ALWAYS distribute with the documentation.
If you feel that this program has been of some utility, feel free to send
me a few bucks (say, $10.00) to help defray the CompuServe costs run up
in developing this utility. If you are using this program in a commercial
environment, please consider this mandatory.
William J. Hinkle [71121,3211]
420 E.Boston Mills Rd.
Hudson, OH 44236-1111