
mgif 1.0
--------

This is a GIF viewer for mono STs. It uses Floyd-Steinberg dithering to
represent color images on bi-level devices. My reference was Burger and
Gillies, "Interactive Computer Graphics", though the PBMplus package and
I believe fbm also have similar algorithms (which I found after I wrote
my own...oh well...). This is a .ttp file and is geared for use from a
shell (like gulam). No mouse, etc. The inquiry only feature (-q and -h)
should port to Unix, though there are (doubtless) better tools than this
available.

This uses line A, so it will probably not work on a TT (do they come with
1-bit displays anyway?). I have done some optimization, but it does not
really "scream". It takes about 55 seconds to do a 320x200 unexpanded
image. I have not tested it with any larger images (i.e. 1024x1024) though
it *should* work :-). Most (3/4) of the time is spent in the dithering
and display for you tweakers. The line A routines are just put pixel and
draw line, so it should port to the TT. I'd try it, but I have no TT.
Anyone care to borrow me one?  :-)

It should handle all image sizes, but clips to max of 640x400. It only
handles up to 8-bit images. I do not think there is a 24-bit GIF format
anyway.

It can rotate, mirror, invert, and expand images. Expansion is best with
320x200 images (which double to 640x400), though it will simply clip (based
on -xn and -yn, if present) to fit the screen. Mgif can also change the
relative intensity of the image (in the dithering phase, use -sn or -dn).
There is an inquire option to just print info about the image (size, bits,
etc). A histogram of relative frequencies of intensities is also produced.
Note that expansion of the image is accomplished by shifting each raster
(row of pixels) then filling in the holes by simple averaging the adjacent
pixel RGB values. New rasters are added just by repeating the last row
which gives reasonable results because of the F-S error distribution (i.e.
it does not look like the pixels are actually 2 pixels high as you might
expect).

This is not a perfect system, but does work well for me. Besides, you have
the source, hack away. The hard part was the decompression anyway.

One of the things I would eventually like to do is add histogram equalization
and possibly color quantization, though I suppose getting too fancy would
make it more worth it to just port PBMplus. It would also be nice to do a
better job at scaling the intensities. It also has the ability to write a
GEM/Degas-ish .pi3 file from the screen. Included in the post is a simple
viewer for .pi3 files. I have not finished the panning for larger images,
but that should be a relatively easy hack (see "todo" file).

Oh, I forgot: the gif decompression was lifted from PBMplus (giftoppm)
which in turn was lifted from compress(1). The rest is original. It is based
on my earlier post of pi1tomon (for uncompressed .pi1 images). Incidently,
I have modified that quite a bit since I posted it earlier this year. And
GIF is trademark of CIS, Unix is a trademark of ATT, etc. This program is
free for unlimited use. The PBMplus part probably is not (though still
free for non-commercial use). 

enjoy...


-bill rosenkranz
rosenkra@convex.com
