home *** CD-ROM | disk | FTP | other *** search
/ Amiga GigaPD 3 / Amiga_GigaPD_v3_3of3.iso / fred_fish / fish_601-700_lha / fish_694.lha / PGMTOSHD / pgmtoshd.doc < prev    next >
Text File  |  1993-06-02  |  8KB  |  139 lines

  1. pgmtoshd - By Dan Charrois
  2. ==========================
  3.  
  4. How many of you Amiga 500 and 2000 owners have forgotten about your
  5. monochrome video jack?  This is an RCA jack to allow for the usage of 
  6. inexpensive monochrome monitors.  Since most Amiga owners use a color 
  7. display, this can often be overlooked.  However in the interest of 
  8. increasing the versatility and capabilities of a standard, unexpanded 
  9. Amiga, this jack can come in surprisingly useful.
  10.  
  11. The video modes that all Amigas are capable of using provide them to 
  12. choose from a palette of 4096 colors (16 intensities each of red, green, 
  13. and blue).  Although this seems like an incredible range to choose from,
  14. it suffers from the limitation in that there are only 16 shades of gray 
  15. available.  Black and white (grayshade) pictures thus suffer a great deal 
  16. due to quantization error, and dithering techniques must be used to avoid 
  17. "banding" in the image.  This noticeably reduces image quality, and may 
  18. not in all cases lead to a totally acceptable image.  Here's where the 
  19. monochrome video jack comes to the rescue.
  20.  
  21. According to the Amiga Hardware Reference Manual, the signal sent out the 
  22. monochrome jack consists of 30% of the red signal, 60% of the green, and 
  23. 10% of the blue.  Using this combination, 151 possible intensities of 
  24. gray are output on this jack, depending on the color being displayed.  
  25. All that is required to make use of these 151 intensities is the standard 
  26. Amiga 500 or 2000, a monitor providing composite video input (such as the 
  27. Commodore 1084 monitor), the appropriate cable, and software to make use 
  28. of the monochrome jack's capabilities.  Unfortunately, an Amiga 1000 will 
  29. not work, since its jack provides color output.  I am unsure as to 
  30. whether or not the Amiga 3000 contains a monochrome jack as I have never 
  31. seen the 3000.  It will be up to A3000 owners to find out for themselves :-). 
  32.  
  33. The best part of this is that it requires no hardware modifications at 
  34. all to your Amiga.  The only thing you need provide is a standard 
  35. shielded RCA cable.  I provide the software - "pgmtoshd".  With this 
  36. combination, you will be able to view black and white images with almost 
  37. ten times more gray shades than before!
  38.  
  39. The software
  40. ------------
  41. First of all, this program is shareware.  If you use it and find it 
  42. useful, please send a small donation of $5.00-$10.00 to help out a 
  43. starving student.  The more donations I get through distributing 
  44. shareware, the more likely I am to keep releasing hopefully useful 
  45. programs such as this one to expand the usage of the standard Amiga.  
  46. This program is NOT to be included with any commercial software at all
  47. without my prior written consent.  My address is at the end of this 
  48. document.  On the other hand, permission is granted to include this 
  49. archive, provided it remains intact, in any program library (such as the 
  50. Fred Fish disk collection) so long as it is not a commercial venture.  This 
  51. means that you can feel free to spread it around to any BBSes or archive 
  52. sites without my consent provided that nobody makes any money in the 
  53. process.
  54.  
  55. "pgmtoshd" takes a standard Portable Graymap (.pgm) file and converts it
  56. to a Portable Pixmap (.ppm) file containing the proper colors which, when 
  57. viewed with the monochrome composite output, will yield a possible 151 
  58. shades of gray.  As such it is definitely not a stand-alone program, 
  59. requiring at least the pbmplus library of graphics manipulation 
  60. functions.  This approach though, allows it to filter files appropriately 
  61. so as to enable grayshade viewing of far more graphics formats than I 
  62. could ever hope to write conversion routines for (why re-invent the 
  63. wheel...)  If you don't already have it then, obtain the pbmplus library.
  64. Also useful is Steven Reiz's excellent utility 'wasp' for converting the 
  65. .ppm file into one of the standard Amiga formats, and Sebastiano Vigna's 
  66. "Mostra" for viewing them.
  67.  
  68. As mentioned, pgmtoshd converts .pgm files into .ppm files containing the 
  69. appropriate colors for viewing in black and white through the composite 
  70. input.  Input is from standard input and output to standard output, so 
  71. redirection must be used to process files.  Suppose, for example, you 
  72. have a GIF file which is a 256 color black and white image that you wish 
  73. to view on the Amiga.  Instead of being limited to quantizing those 256 
  74. gray shades into 16, pgmtoshd will preserve a lot more of the information 
  75. for you.  The complete sequence of events necessary to view this file, 
  76. using the pbmplus library, wasp, and Mostra (named 'M') is as follows:  
  77. (assume that the GIF you wish to view is named 'filename.gif'...)
  78.  
  79. giftoppm >filename.ppm filename.gif        ;Convert gif to ppm file
  80. ppmtopgm >filename.pgm filename.ppm        ;Convert ppm to pgm
  81. pgmtoshd <filename.pgm >filename.shd       ;Convert pgm to shaded ppm
  82. wasp -xaverage -ham -lace filename.shd filename.ham    ;Convert to standard HAM
  83. m filename.ham                             ;View the image
  84.  
  85. If you use a shell which supports piping in a manner such as CShell, this
  86. can be easily done without so many temporary files, as follows:
  87.  
  88. giftoppm filename.gif | ppmtopgm | pgmtoshd >filename.shd
  89. wasp -xaverage -ham -lace filename.shd filename.ham
  90. m filename.ham
  91.  
  92. Notes: -giftoppm and ppmtopgm are located in the pbmplus library
  93.        -I use the above invocation of 'wasp' the most frequently.  Though 
  94.              151 grey shades are available instead of 16, a method must 
  95.              still be used to be able to view them all on the screen 
  96.              simultaneously.  HAM is good for this.  Other possibilities 
  97.              are SHAM and Dynamic Hires.
  98.        -The script will convert any GIF file (not just those which are 
  99.              B&W) into the appropriate grayshaded image.
  100.        -To view the image in black and white (instead of the blue and 
  101.              greenish colors that pgmtoshd produces), ensure that you are 
  102.              viewing the composite input - not the standard RGB.  On the
  103.              Commodore 1084 monitor, a switch is provided in the front to
  104.              switch between the different inputs.
  105.        -.ppm and .pgm files (as well as the PPM file with extension .shd
  106.              produced by pgmtoshd) are huge (.pgm file being one byte 
  107.              per pixel and .ppm files being three bytes per pixel).  If 
  108.              you don't have a lot of RAM for storing them or a hard 
  109.              drive (and instead must use floppies), you may be limited in
  110.              the size of files you can convert.
  111.  
  112. I include two standard Amiga images so you can see the difference made by 
  113. my software before you go aquiring the pbmplus library and wasp.  They
  114. are named test.iff and test.ham.  The image was created by pgmramp and 
  115. are simply a picture of a smooth gradiation from black at the top of the 
  116. screen to white at the bottom.  Test.iff is the standard image, viewable 
  117. through either the composite or RGB inputs, where the banding is clearly 
  118. visible.  Test.ham is the image converted with pgmtoshd.  Viewed through 
  119. the monitor's RGB input it will appear as a bunch of blue/green/yellowish 
  120. lines, but viewed through the monochrome composite input should appear as 
  121. a nice gradiation from black to white.  These files must be viewed with a 
  122. standard IFF viewer, such as Mostra.
  123.  
  124. If you have any questions concerning the operation or theory behind 
  125. pgmtoshd, please drop me a note and I'll do my best to answer them.  I 
  126. may be reached at:
  127.  
  128. Dan Charrois
  129. Box 75
  130. Legal, AB
  131. T0G 1L0
  132. CANADA
  133.  
  134. EMail: charro@bode.ee.ualberta.ca
  135.  
  136. Have fun - hopefully you find this program as useful as I have!  Dan
  137.  
  138.  
  139.