home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Der Mediaplex Sampler - Die 6 von Plex
/
6_v_plex.zip
/
6_v_plex
/
DISK2
/
MULTI_04
/
GRAYPCX.ZIP
/
GRAYPCX.TXT
< prev
next >
Wrap
Text File
|
1990-03-28
|
6KB
|
122 lines
GRAYPCX- a program to convert monochrome PCX files, as produced by hand
scanners, to gray-level PCX files. The result will be 1/6 the size
horizontally & vertically, and will be well suited for VGA viewing.
This program also will convert any file in the 256 color PCX format to
gray-level.
GRAYSET- a program to evaluate monochrome PCX files, to determine
resulting gray levels. It also will suggest settings for the controls in
GRAYPCX, and write a file for GRAYPCX's automatic use of them.
Quick start instructions:
Save your scan in the PCX format, run GRAYSET from the command line:
GRAYSET (scan file name) 1
Then run GRAYPCX with the command line:
GRAYPCX (scan file name) (gray file name) 1
This configuration will use GRAYSET's calculate values. To see the
conversion with them not adjusted, change the "1" at the end of the command
line starting GRAYPCX to "0".
Program options:
GRAYSET- If you have scanned a large image in several files that are to
be pasted together, it is important that the same settings be used for all,
and also the lightest and darkest areas be included in GRAYSET's
calculations. Start the program with a "1" switch for the initial file,
then rerun using "2" for the remaining files. Please note that GRAYPCX
will use the settings from the last running of GRAYSET.
GRAYPCX- In addition to the two command line switches, starting the
program with the command line without the "0" or "1" will allow other
options, including the gray-level converting of color files, and setting
the contrast, brightness and gamma separately, as well as different numbers
of grays for the conversion. In this variation, conversion of the scans is
a two pass operation- mono scan to 37 gray PCX (in the 256 color format),
then color conversion to 16, 32 or 64 grays. Please note that standard VGA
cards can view much larger 16 gray conversions than 64 or 32 grays, as the
later must be viewed in the 256 color modes.
Now, after boring you with all that technical detail, some words on why,
and what it all means.
After seeing many scans converted to GIFs, I could see two basic problems
with many of them. One is conversions that have the appalling, spotty look
produced by other than 1/6 size reduction, and the other is the conversion
program produce 37 grays, but IBM hardware doesn't do 37 grays, it does the
closest match to 64 or 16 grays. If you want to read some details why only
1/6 size is (mostly) correct, read the text in SCANGF.ARC which can be
found in DL-6, Graphic Support forum, CIS.
After the initial version of this program, Jim Beebe egged me into
including the dreaded "gamma" factor. The problem with gamma is unless the
scans are contrasty, that is, include what will become all 37 grays, some
adjustments have to be done. And with three adjustment, the opportunity
exists to really mess things up, so I decided to do a automatic adjustment
program, GRAYSET. As it was all Jim's fault anyway, I used the "look and
feel" of his HISTOGIF for the little graph the program displays. You may
find this of value in adjusting your scanner.
What the optional adjustments do:
Gamma: The gamma factor is a attempt to balance the actual increase in
screen illumination from the various VGA settings, to correspond to the
monochrome increase. A value of 2.0 is theoretically correct, according to
Jim BeeBe, but the effect seems excessive at this level, especially if
there are few dark areas in the scan. I suggest trying a value of about
1.3 or 1.5 here, and also using a higher contrast factor (in the second
step).
Brightness: This adjustment will allows all grays in the scan to be
moved an equal amount darker or lighter.
Contrast: Many of the scans of color pictures, or conversions from color
PCX files (color in this case meaning not B&W) seem to lack contrast. In a
gray level conversion, the best results will often be if the lightest
colors convert to 100% white, the darkest to 100% black, but this is often
not the case. The contrast factor allows you to adjust this, by sort of
"spreading" the luminance levels. I suggest you try conversions with
several setting on this to see what it does.
256 Color PCX conversion: If the program finds one of these as your
input file, it will ask two questions, output type and contrast factor. A
conversion to 64 will result in better viewing, in most cases, on SVGA
machines, and 32 or 16 colors will produce a graphic that can be better
viewed on other machines, in particular, 256K VGA cards, which don't have
the bigger 256 color modes, and Amigas, which only have 16 grays in their
palette.
Interlaced 32/16 gray output: This experimental conversion is an attempt
to produce a version that lets you have your cake and eat it too, viewing
well in a 16 color mode, but better in a 32 or 256 color one. This
conversion places every other gray of a 32 gray conversion in the first 16
colors, the remainder in the second set of 16. It seems to work with
PICEM, after the file is converted to a 32 color GIF.
In all four color reduction options, the reduction is done with a
distributed error dither thru a Sierra filter. Any yes, you can get more
than 37 grays from the 37 gray starting file, one test run produced 57
actually used. The reason for this is that the VGA doesn't have grays that
exactly match the ones produced by the 37 gray conversion, so the dither
will alternate between the best match it can find. Remember, in no case
can VGA equipment ever display more than 64 levels of gray (or any pure
color, for that matter).
Some words about GIF conversion: If you intend to convert the PCX files
produced by this program into gray level GIF files, I recommend running the
GIF thru a utility like CLIP, and using it to produce a standard size (like
640 x 480) file, correctly incoded with either 37 (the file will actually
be 64), 64, 32 or 16 colors. Note that the conversions produced by this
program will be in 37, 64, 32 or 16 colors _USED_, but will be in the 256
color PCX format, and most conversions will make a 256 color GIF from them.
Jim Burton, CIS 73210,3557
Copyright (c) James A. Burton, 1990. I intend these programs to be
free-ware, but I require they be distributed as a package of: this text
file, GrayPCX and GraySET. Source code available on request.