Dec 262017
Read GIF formatted files with HERCULES or CGA!!.
File GREY.ZIP from The Programmer’s Corner in
Category Display Utilities
Read GIF formatted files with HERCULES or CGA!!.
File Name File Size Zip Size Zip Type
GREY.DOC 6913 2932 deflated
GREY.EXE 28268 18194 deflated

Download File GREY.ZIP Here

Contents of the GREY.DOC file

The Greyscale GIF Decoder
Rev 1.5

Copyright (c) 1987 by Michael Vigneau

GREY is a program that will display a GIF (Graphics Interchange Format)
image in "greyscale", using an IBM CGA card, Hercules card, or equivalent.
GREY can handle any image up to 720 x 400 pixels, and up to 256 total colors.
The program converts all colors to grey values, then displays those values
using halftoning and dithering techniques. GREY also supports "true"
greyscale on a VGA (Video Graphics Array).

GREY requires at least 160K of free memory to run.

The format for GREY is:

[d:path\]GREY [-options] [d:path\]gif-file[.gif]

Options are:
-c CGA (default)
-h Hercules
-v VGA: 64 shades only

Display Modes (CGA and Hercules only):
0 Black/White only
1 3 shades, medium res
2 9 shades, ordered dither
3 9 shades, slanted dither
4 33 shades, ordered dither
5 33 shades, slanted dither

-r Reverse the image

Options can be in either upper or lower case.

Display modes are selected by entering the mode number after the option,
for example, -c3 . If no display mode is selected, GREY will display a menu
of valid choices. This allows the same image to be loaded once and viewed
using different display modes. Display modes are not used with the "-v"

You can also switch between display modes by pressing the desired number
key while the image is displayed. The new image will be drawn on top of the
previous image, using the new mode. This helps show the differences between
the various modes.

Please note that the mode numbers have changed since the previous version
of GREY. Some less useful modes have been eliminated, while others have been
added. Also, the Black/White mode now displays the image full-screen.

The VGA mode draws the image using Mode 13h, known as "multi-color" or
"MCGA" mode. The palette is set to produce 64 grey scales. Since this is
performed by the hardware, no dithering or halftoning modes are needed.
VGA mode will also work on PS/2 Models 25 and 30, the 8514/A Display Adapter,
the PS/2 Display Adapter, and "VGA compatible" cards that support MCGA mode.
(The program now uses BIOS to set the mode and palette.)

Of course, the above hardware will support the CGA modes also.


If you have a "screen dump" program (such as GRAPHICS.COM or HARDCOPY),
you can print the image by hitting the PrtSc (Print Screen) key. You may
need to reverse the image before printing (see below).

You cannot use this method in VGA mode, unless you have a utility
specifically made to print Mode 13h (MCGA) screens.


If you have an LCD or other display that "draws" in black instead of
white, you should use the "-r" option. This will reverse the black and white
dots, making the image viewable. This option can be used in combination
with other options, ex: GREY -C3 -R CHERYL.GIF .

You can also reverse the image by pressing the "R" key while the image is
displayed on the screen. This may be useful for printing "screen dumps".

The reverse feature is not supported in the VGA mode.


GREY first reads the GIF file into memory. It does this for two reasons.
First, if the image is greater than 320 x 200 pixels, GREY merges the
pixel data into this size. (This is done mathematically, NOT by skipping
pixels.) It does this to conserve memory, and to speed up the display. The
second reason for storing the image is to handle "interlaced" files; the
shading algorithms sometimes work with more than one raster line at a time,
and an interlaced image mixes up the order of the lines. Any interlaced
file is "de-interlaced" while it is being read into memory.

As the file is being read, the colors in the image are converted to
their equivalent grey values. This produces an exact greyscale
representation of the color image, similar to a black and white photo of a
color object. This "greymap" is then rendered onto the display screen,
using the chosen Display Mode.


Different display modes work better for some types of images than for

Choosing "Black/White" (mode 0) forces GREY to create an image where each
pixel translates to either pure black or pure white. This feature is included
for comparison with the greyscale versions.

Mode 1 is a 3-shade halftone. This means that each pixel is either
black, white, or "grey", which is a checkerboard of both black and white

Modes 2 and 3 are 9-shade dithers. Modes 4 and 5 are 33-shade dithers.
Dithering creates dot patterns that approximate grey shades. Larger dither
patterns produce more grey shades, but tend to "wash out" the image. GREY
uses two types of dithers, "ordered" and "slanted", each with two pattern
sizes. The even numbered dither modes are "ordered", the odd ones are

The ordered dithers use a well-defined pattern that is designed to
minimize contouring. Each successive pattern differs from the previous
pattern by only one pixel. The patterns are built up in an ordered fashion.

A "slanted dither" is my own variation on the ordered dither. Instead
of building the dither pattern on a square grid, the pattern is created on
60 degree diagonals. This eliminates the "x" and "+" artifacts that the
ordered dither produces, as well as the square grid dots on some shades.
However, a different artifact occurs: slanted lines.

At a distance, there is no difference between the ordered and slanted
dithers; the same number of dots are produced in each case. When viewed
at close range, the slanted dither sometimes produces better results. Use
whichever pattern you prefer.


To display all GIF pictures in a directory, type the following line at the
DOS prompt:


Put any options desired between the "GREY" and the final "%X".


If you find GREY to be useful to you, I would like to hear from you.
I am open to suggestions for improvements. Please correspond via Easyplex
to [76703,4275] or write a letter to:

Michael Vigneau
25 Emerald St.
Newton, MA 02158

I hope you enjoy using GREY.

GIF and 'Graphics Interchange Format' are trademarks (tm) of
CompuServe Incorporated, an H&R Block Company.

 December 26, 2017  Add comments

Leave a Reply