home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / graphics / utility / mgif35b / readme < prev    next >
Encoding:
Text File  |  1991-06-18  |  12.6 KB  |  247 lines

  1.  
  2. mgif 3.5
  3. --------
  4.  
  5. This is a new version of a GIF viewer for mono STs. The major change
  6. (version 1.1 or 1.2 was the last I posted) is to add "flicker" mode
  7. display to simulate grayscale and to add lots more image processing
  8. functions (the flicker trick makes it possible to render color or
  9. grayscale images suprisingly well on a mono tube). However, a few things
  10. were removed and need to be added (like image rotation). This only works
  11. on monochrome and is hardwired to 640x400 tubes! It is also coded to use
  12. about 1.4 MB of memory, so it will handle up to 640x625 images. It also
  13. means that the binary won't run on a 1 MB system. It also uses line A
  14. (which can be easily replaced since I only use it to draw vertical/
  15. horizontal lines which can be done directly to Physbase). At least I did
  16. not use any undocumented stuff :-).
  17.  
  18. NOTE: this only works on GIF87a files, not the newer standard. If/when
  19. I get that, I might modify it to do both. It will only work on the first
  20. image of multi-GIF files as well. Actually, mgif will also do .pi1 and .pi2
  21. files, too.
  22.  
  23. ALSO NOTE: despite what SOME people may say, I have 2 undocumented command
  24. line switches: -help and -version. They do what you expect. I also put
  25. this in ALL my software, even stuff I write for unix. I think this is
  26. INFINITELY better than using man(1) just for a quick reminder. It also
  27. tends to be more current, especially if manpages are not updated as often
  28. as you would like. And I think this is better than using something like
  29. strings `which mgif` | grep -i mgif to find the version number, if it
  30. even exists (it does in most of my codes)...
  31.  
  32.  
  33. Changes
  34. -------
  35.  
  36. Here are the major changes (1.x to 3.2):
  37.  
  38.     - Mgif is now more or less interactive only. It does not make
  39.       sense to work batch with flicker mode. Most of the command
  40.       line switches are gone.
  41.  
  42.     - There is now no file output (yet). I hope to develop some
  43.       sort of file format for flicker palettes. Don't hold your
  44.       breath, though. [ changed in 3.5, see below. ]
  45.  
  46.     - Image processing functions include histogram equalization,
  47.       contrast stretching, inversion, blurring, brightening, median
  48.       filtering, thresholding, log scaling, resizing (only powers
  49.       of 2: 2x, .5x, ...), convolutions, etc.
  50.  
  51.     - GIF decoding is now a single entry point so source could be
  52.       used for other applications. Flicker code is as well. Just
  53.       pass it a pointer to the grayscale image along with its size.
  54.  
  55. Actually, I just submitted version 3.2 a few weeks ago. This post is version
  56. 3.5. The changes from 3.2 to 3.5 are:
  57.  
  58.     - Read Degas PI1/PI2 files as well (-pi1 and -pi2 switches).
  59.  
  60.     - Add cut option to cut out a piece of the image for further
  61.       processing. Mgif can handle images with one or both dimensions
  62.       larger than the screen, as long as the image itself is smaller
  63.       than MAXIMG (now 400,000) pixels.
  64.  
  65.     - Add option to selectively enlarge/shrink by direction, vertical,
  66.       horizontal, or both.
  67.  
  68.     - Fix bugs (actually out right algorithmic errors) in median, log
  69.       scaling, and a couple of other things.
  70.  
  71.     - Add a file save option (*.fl files) and a viewer for these
  72.       "flicker" files. These files are just a header and copies of
  73.       each screen used by the flicker routines. Note that to save
  74.       space, only the actual used part of the screen is saved. For
  75.       example, a 320x200 image uses about 24k (1/4 of each of the 3
  76.       screens). A .fl viewer is also added to mgif now using the
  77.       switch -fl. Note that you either view GIFs/PI*s or FLs, not
  78.       both at the same time. I have also included in the source post
  79.       a standalone viewer, showfl. Both mgif and showfl will attempt to
  80.       make a mosaic of several files which is useful for comparing
  81.       the results of your image processing. Realize that there are
  82.       only 640x400 pixels to work with, so it displays up to 4 320x200
  83.       images, up to 6 200x200 images, or up to 2 320x400 images.
  84.  
  85.     - Change point coord specifications (e.g. in cutting) from numerical
  86.       input to arrow key-driven crosshair. Much easier this way!
  87.  
  88.     - Add zoom option which uses an arrow key-driven box to detect
  89.       a rectangle to enlarge. This is currently always a 2x zoom
  90.       i.e. width and height of zoom area are half image size. The
  91.       resulting image is the same size as the original.
  92.  
  93.     - Can copy raster images for transformed area to original area and
  94.       visa versa. Doing so will destroy the image in the copied to area.
  95.       This is like a checkpoint of a long processing train that may
  96.       split where if it does not work out, you want to go back to an
  97.       intermediate image.
  98.  
  99.     - A histogram is also displayed directly on the flicker screen.
  100.       Some word about the flicker drawing is required. When the routine
  101.       is entered, it draws one of the flicker planes to the screen and
  102.       the other two to buffers. During this time, any key will stop
  103.       this process and the partially rendered image is flickered instead.
  104.       After the flicker is set up, the actual draw starts by slowly
  105.       cycling through individual screens (just so you can see them).
  106.       This, too, can be interupted with a single key (any). The fully
  107.       speed flicker should appear after 2-3 seconds. It stays there until
  108.       you press any key. After that, a histogram is mapped onto each
  109.       flicker screen and the image displayed until a key is pressed.
  110.       Finally, the histogram is replaced with the portion of the image
  111.       it overlaid, and you go back to the command line.
  112.  
  113.  
  114. More of what it is
  115. ------------------
  116.  
  117. Mgif uses Floyd-Steinberg dithering to represent color images on bi-level
  118. devices as well as the so-called "flicker palette". I was graciously
  119. presented with a copy of some routines to do the flicker stuff from
  120. Klaus Pedersen (micro@imada.dk) and I adapted it for use with mgif. He
  121. used a combination of F-S and rapid (Vsync) screen switches, resulting in
  122. suprisingly good grayscale image quality on a monochrome monitor. This is
  123. a major win, IMHO. Thanx, Klaus! I think mgif's original F-S dither was
  124. better than Klaus's without flicker, but the flicker trick really blows
  125. away ANY simple F-S. The F-S dither implemented always scans left to
  126. right to propagate errors. A better way is to alternate directions on
  127. alternate scan lines for even better image quality. I have not had time
  128. to change this, however. The code is pretty dicey as it is, so I invoked
  129. the usual principles of (good) software engineering: KISS, INBDFI (If Not
  130. Broke Don't Fix It), etc.
  131.  
  132. It handles reasonable image sizes, but clips to max of 640x400. Reasonable
  133. here means PC-ish (640x480 VGA, etc) images, not megapixel images which
  134. need a heck of alot of memory and/or different coding methods (i.e. GIF
  135. direct to screen). It should handle up to 8-bit images (which is max GIF
  136. format, I believe). I have limited the size of the internal arrays to hold
  137. the raw GIF image and the decoded image. It could fit on an empty 1 MB system
  138. (if recompiled) and will handle images up to 400,000 pixels, plus or minus.
  139. The included binary will need 1.4 MB of memory. To get it to fit on a
  140. 1 MB system, change the CodedGIF[] array dimensions to about 150,000 and
  141. the Raster[] and TransRaster[] array dimensions to 310,000. It should then
  142. be able to handle most images 640x480 or smaller in 1 MB. I have not tried
  143. this (since I have a mega 4) so you may need to play around. Look at the
  144. mgif.h file for the defines. The especially daring can patch the binary.
  145.  
  146. Mgif is pretty big and as compiled will not fit on a 1 MB system. The size
  147. of the executable is:
  148.  
  149.     43292+12030+1330634+0 1385956
  150.  
  151. plus a stack of 32k, as I recall. The big space is 2 (static) buffers of
  152. size MAXIMG (400000) and 1 of size MAXRAW (also 400000 bytes). This allows
  153. images up to 640x620 or so to be read, thus easily accomodating PC-ish GIF
  154. images of size 640x480 or smaller. You can always recompile for lesser
  155. memory systems. Try (in mgif.h) MAXRAW of 190000 and MAXIMG of 300000. This
  156. should make it squeeze into a 1 MB system, without DAs, TSRs, or whatever,
  157. and should still handle images up to 640x480 pixels. MAXRAW is for the
  158. coded GIF file (before LZW decoding). I read it into memory to try and
  159. speed up the decode. This, too, can be changed, to do it on the fly. Since
  160. I generally have 2 MB of free memory, I don't really worry about it. I also
  161. don't even try really large images just because it takes too long. Note
  162. that I don't thing ReadGIF checks to see if the coded file will fit into
  163. the space provided, so there may be a problem if you reduce MAXRAW with
  164. especially large images. The is no problem as distributed, other than
  165. you need at least 1.4 MB of free memory.
  166.  
  167. There are 2 posts: binary and source. If you make any significant
  168. enhancements, I'd appreciate a copy (source), especially if it speeds things
  169. up. I made the tradeoff of speed for modularity. Stuff in ReadGIF could
  170. be inlined and simplified. However, this is pretty much the way it came
  171. from PBMplus, more or less. It takes 15 to 25 sec to decode a 320x200 image
  172. which is not too bad. Also, the conversion to grayscale should go much
  173. faster. Flicker goes about as fast as it is going to go without major
  174. changes (like inlining, etc). Some of the area processes should be faster
  175. as well, especially enlarging. All in all, it may take 50 to 60 seconds
  176. to read, decode, and display a 320x200 GIF file.
  177.  
  178. Also note, that because of its modularity, you can easily add the ability
  179. to read other file formats (like Spectrum). Just put the hooks on on the
  180. command line (a la "-pi1") and add a ReadWhatever() routine to decode the
  181. file. Someday I may add an option to read PBMplus PGM (graymap) or PBM
  182. (bitmap) files.
  183.  
  184. The raster array contains an index for each pixel into a RGB color
  185. table. You set up the raster and the color map. See ReadPI1 for an good
  186. example (which also re-quantizes PI1 8 index palettes into 256 values via
  187. a simple table lookup). No serious checking of command line file names is
  188. done (is that REALLY a .gif file?) so be careful. It should kick you out,
  189. however, if the file's "magic number" is bad, however.
  190.  
  191. It is also fairly easy to patch in new image processing algorithms. If
  192. people do this, I'd appreciate source.
  193.  
  194. enjoy...
  195.  
  196. -bill rosenkranz
  197. rosenkra@convex.com
  198.  
  199.  
  200.  
  201.  
  202. Binary manifest:
  203.  
  204. Name          Length    Stowage    SF   Size now  Date       Time    CRC
  205. ============  ========  ========  ====  ========  =========  ======  ====
  206. CURLEY.FL        24266  Squeezed   23%     18859  19 Jun 91   0:19a  2AE0
  207. MGIF.1           18389  Crunched   50%      9228  15 Jun 91   4:43a  EF18
  208. MGIF.TTP         69834  Crunched   45%     38757  19 Jun 91   0:02a  E371
  209. README           12407  Crunched   43%      7127  19 Jun 91   0:42a  0014
  210. TODO               693  Crunched   29%       496  19 Jun 91   0:34a  2AE6
  211.         ====  ========            ====  ========
  212. Total      5    125589             41%     74467
  213.  
  214. Note that MGIF.1 is the formatted manpage with imbedded control chars for
  215. use with manpager. If you don't use manpager (shame on you!) you can either
  216. edit this file, removing the vt100-ish escapes, or reformat the document
  217. with nroff.
  218.  
  219. CURLEY.FL is a flicker file. View with:  mgif -fl curley.fl. It was made
  220. from curley.gif (about 35kB, 320x200x256 image). You MUST use a monochrome
  221. monitor! No checks are made if you don't. It probably WILL CRASH YOUR SYSTEM
  222. if you try this with a color monitor! Consider yourself warned...
  223.  
  224.  
  225. Source manifest:
  226.  
  227. Name          Length    Stowage    SF   Size now  Date       Time    CRC
  228. ============  ========  ========  ====  ========  =========  ======  ====
  229. FILE.C            5341  Crunched   50%      2673  15 Jun 91   1:50a  5F32
  230. FLICKER.C        22285  Crunched   52%     10784  14 Jun 91   2:28a  1518
  231. LINEA.S           2740  Crunched   45%      1534  15 Jun 91   0:13a  D75D
  232. LOW.C            21604  Crunched   54%     10109  14 Jun 91  11:43a  DB2F
  233. MAKEFILE          2518  Crunched   44%      1424  19 Jun 91   0:50a  F53C
  234. MGIF.C           52391  Crunched   53%     24673  18 Jun 91  11:43p  4500
  235. MGIF.H            3240  Crunched   48%      1715  13 Jun 91   9:49a  37D7
  236. MGIF.MAN         17497  Crunched   48%      9128  15 Jun 91   4:31a  0B46
  237. PROCESS.C        38784  Crunched   60%     15857  15 Jun 91   0:02a  87BC
  238. READGIF.C        26038  Crunched   55%     11855  13 Jun 91  10:42a  70F4
  239. README           12407  Crunched   43%      7127  19 Jun 91   0:42a  0014
  240. READPI.C         11591  Crunched   54%      5348  13 Jun 91  10:42a  BE3F
  241. SHOWFL.C          8730  Crunched   51%      4329  19 Jun 91   0:22a  E53D
  242. SHOWFL.MAN        1432  Crunched   32%       984  15 Jun 91   1:33a  80C8
  243. TODO               693  Crunched   29%       496  19 Jun 91   0:34a  2AE6
  244.         ====  ========            ====  ========
  245. Total     15    227291             53%    108036
  246.  
  247.