home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_progs
/
graphics
/
pgmtoshd.lha
/
pgmtoshd.doc
< prev
next >
Wrap
Text File
|
1992-07-13
|
8KB
|
139 lines
pgmtoshd - By Dan Charrois
==========================
How many of you Amiga 500 and 2000 owners have forgotten about your
monochrome video jack? This is an RCA jack to allow for the usage of
inexpensive monochrome monitors. Since most Amiga owners use a color
display, this can often be overlooked. However in the interest of
increasing the versatility and capabilities of a standard, unexpanded
Amiga, this jack can come in surprisingly useful.
The video modes that all Amigas are capable of using provide them to
choose from a palette of 4096 colors (16 intensities each of red, green,
and blue). Although this seems like an incredible range to choose from,
it suffers from the limitation in that there are only 16 shades of gray
available. Black and white (grayshade) pictures thus suffer a great deal
due to quantization error, and dithering techniques must be used to avoid
"banding" in the image. This noticeably reduces image quality, and may
not in all cases lead to a totally acceptable image. Here's where the
monochrome video jack comes to the rescue.
According to the Amiga Hardware Reference Manual, the signal sent out the
monochrome jack consists of 30% of the red signal, 60% of the green, and
10% of the blue. Using this combination, 151 possible intensities of
gray are output on this jack, depending on the color being displayed.
All that is required to make use of these 151 intensities is the standard
Amiga 500 or 2000, a monitor providing composite video input (such as the
Commodore 1084 monitor), the appropriate cable, and software to make use
of the monochrome jack's capabilities. Unfortunately, an Amiga 1000 will
not work, since its jack provides color output. I am unsure as to
whether or not the Amiga 3000 contains a monochrome jack as I have never
seen the 3000. It will be up to A3000 owners to find out for themselves :-).
The best part of this is that it requires no hardware modifications at
all to your Amiga. The only thing you need provide is a standard
shielded RCA cable. I provide the software - "pgmtoshd". With this
combination, you will be able to view black and white images with almost
ten times more gray shades than before!
The software
------------
First of all, this program is shareware. If you use it and find it
useful, please send a small donation of $5.00-$10.00 to help out a
starving student. The more donations I get through distributing
shareware, the more likely I am to keep releasing hopefully useful
programs such as this one to expand the usage of the standard Amiga.
This program is NOT to be included with any commercial software at all
without my prior written consent. My address is at the end of this
document. On the other hand, permission is granted to include this
archive, provided it remains intact, in any program library (such as the
Fred Fish disk collection) so long as it is not a commercial venture. This
means that you can feel free to spread it around to any BBSes or archive
sites without my consent provided that nobody makes any money in the
process.
"pgmtoshd" takes a standard Portable Graymap (.pgm) file and converts it
to a Portable Pixmap (.ppm) file containing the proper colors which, when
viewed with the monochrome composite output, will yield a possible 151
shades of gray. As such it is definitely not a stand-alone program,
requiring at least the pbmplus library of graphics manipulation
functions. This approach though, allows it to filter files appropriately
so as to enable grayshade viewing of far more graphics formats than I
could ever hope to write conversion routines for (why re-invent the
wheel...) If you don't already have it then, obtain the pbmplus library.
Also useful is Steven Reiz's excellent utility 'wasp' for converting the
.ppm file into one of the standard Amiga formats, and Sebastiano Vigna's
"Mostra" for viewing them.
As mentioned, pgmtoshd converts .pgm files into .ppm files containing the
appropriate colors for viewing in black and white through the composite
input. Input is from standard input and output to standard output, so
redirection must be used to process files. Suppose, for example, you
have a GIF file which is a 256 color black and white image that you wish
to view on the Amiga. Instead of being limited to quantizing those 256
gray shades into 16, pgmtoshd will preserve a lot more of the information
for you. The complete sequence of events necessary to view this file,
using the pbmplus library, wasp, and Mostra (named 'M') is as follows:
(assume that the GIF you wish to view is named 'filename.gif'...)
giftoppm >filename.ppm filename.gif ;Convert gif to ppm file
ppmtopgm >filename.pgm filename.ppm ;Convert ppm to pgm
pgmtoshd <filename.pgm >filename.shd ;Convert pgm to shaded ppm
wasp -xaverage -ham -lace filename.shd filename.ham ;Convert to standard HAM
m filename.ham ;View the image
If you use a shell which supports piping in a manner such as CShell, this
can be easily done without so many temporary files, as follows:
giftoppm filename.gif | ppmtopgm | pgmtoshd >filename.shd
wasp -xaverage -ham -lace filename.shd filename.ham
m filename.ham
Notes: -giftoppm and ppmtopgm are located in the pbmplus library
-I use the above invocation of 'wasp' the most frequently. Though
151 grey shades are available instead of 16, a method must
still be used to be able to view them all on the screen
simultaneously. HAM is good for this. Other possibilities
are SHAM and Dynamic Hires.
-The script will convert any GIF file (not just those which are
B&W) into the appropriate grayshaded image.
-To view the image in black and white (instead of the blue and
greenish colors that pgmtoshd produces), ensure that you are
viewing the composite input - not the standard RGB. On the
Commodore 1084 monitor, a switch is provided in the front to
switch between the different inputs.
-.ppm and .pgm files (as well as the PPM file with extension .shd
produced by pgmtoshd) are huge (.pgm file being one byte
per pixel and .ppm files being three bytes per pixel). If
you don't have a lot of RAM for storing them or a hard
drive (and instead must use floppies), you may be limited in
the size of files you can convert.
I include two standard Amiga images so you can see the difference made by
my software before you go aquiring the pbmplus library and wasp. They
are named test.iff and test.ham. The image was created by pgmramp and
are simply a picture of a smooth gradiation from black at the top of the
screen to white at the bottom. Test.iff is the standard image, viewable
through either the composite or RGB inputs, where the banding is clearly
visible. Test.ham is the image converted with pgmtoshd. Viewed through
the monitor's RGB input it will appear as a bunch of blue/green/yellowish
lines, but viewed through the monochrome composite input should appear as
a nice gradiation from black to white. These files must be viewed with a
standard IFF viewer, such as Mostra.
If you have any questions concerning the operation or theory behind
pgmtoshd, please drop me a note and I'll do my best to answer them. I
may be reached at:
Dan Charrois
Box 75
Legal, AB
T0G 1L0
CANADA
EMail: charro@bode.ee.ualberta.ca
Have fun - hopefully you find this program as useful as I have! Dan