NAME mgif - display colour images in grey scales and manipulate them SYNOPSIS mgif -fl [-m] file.fl ... mgif [flag] ... wildcard ... flags: -x, -xx, -n, -i, -v, -vers, -c, -w, -p, -p0 n, -p1 n, -h DESCRIPTION MGIF 4.2 displays colour images in four grey scales in any of the ST and Falcon030 bitplane modes, and probably the TT modes as well, using a flickering technique and Floyd-Steinberg dithering to get fantastic results. In the Falcon true colour mode 32 grey scales are shown, with dithering, which looks even better. For best results at least 640x400 pixels at 60Hz is recommended. A selection of image processing tools can be aplied to the image to enhance it or produce interesting effects. Versions up to 3.7 of this program were written by Bill Rosenkranz, but development is now continued by Johan Klockars. The currently supported image file formats are: GIF - extension .GIF (GIF87a and GIF89a) JPEG - - " - .JPG or .JPE (only the JFIF file format) PI1 - - " - .PI1 PI2 - - " - .PI2 FL - - " - .FL (this is MGIF's own format) OPTIONS -x Use extra JPEG colour decoding steps to get better results. Without this option a faster grey scale decoding is used. This option has no useful effect in this monochrome only version. -xx The same as -x -n Do not use dithering in JPEG decoding process. This option has no useful effect in this monochrome only version. -i Inquire about the files but do not display them. Ouput contains information like image size, number of bits per pixel etc. -v Show verbose messages. -vers Show MGIF version information. -c Do not copy image from the flicker screens to the normal screen at return to command line mode. Very useful when you run mgif from a window, such as MiNT/toswin or gemini/mupfel. -w Wait for key at startup. Useful if you run mgif from floppy and want to change disk before loading begins. -p Use pipe for command input instead of the usual interaction. This is not yet functional. -p0 n Allocate n Kb memory for the original picture. The default is about one third of the available memory, but not more than 1 Mb. -p1 n Allocate n Kb memory for the new picture. The default is about one third of the available memory, but not more than 2 Mb. -h Show help text. -fl Load files in MGIF's own flicker file format. If not the -m option is used, the pictures are shown sequentially. Press any key to go to the next file. -m Create a mosaic of flicker files. Several images can be displayed on one screen if they are all small enough. Two 320x400, four 320x200 or six 200x200 images are displayed together. Other sizes are treated as the nearest larger size. wild One or more standard wildcards with extensions as above. If a file card has no extension it will be treated as if it was a GIF image. INTERACTIVE COMMANDS The following commands are available at the prompt: Control Commands h Help Prints a brief summary of the available commands. q Quit Move to the next image given on the command line. If there are no more the program exits. Exits the program. Draws the current image. Shows last drawn image again. w What Displays information about image, buffers, load time etc. hi Histogram Plots the intensity histogram of the current image. o Toggle Original Toggle the current image, original/new. Transformations are cumulative only if "new" is current. f File Operations The only available file operation is to save the last screen image to a special file having the .FL suffix. This file will contain the three screen images which are used by the flicker routine to simulate grey scale. In order to save an image in this format you must first display it completely by the flicker routine, ie do not escape the actual screen draw but let it finish. cp Copy Copy the new, transformed image, to the original or the other way around. The former is the most useful. Display Options n Noise Adds noise. Not to the image itself but to the dithering process. This can help in images which have artificial banding as a result of the dithering process. You are asked for a value which is a percentage (0 to 100). Each time "o" is toggled, noise is reset zo zero (off). g Laplace filter This, like noise, is not applied to the image itself but rahter in the dithering process. It helps to define hard edges in images and implements a Laplace filter. A quantity, Beta, is required. A value of one corresponds to a Beta of 0.25, a value of two corresponds to a Beta of 0.50 etc. A value of zero turns off Laplace filtering. It is possible to get the same effect by giving a suitable matrix to the convolution function. Beta is reset to zero when "o" is toggled. Frame Processes e Enlarge Enlarges images two times. You can choose which dimensions should be enlarged as either horizontal, vertical or both. The new pixels inserted are given the average intensity of their neighbours. s Shrink Reduces images two times. You can choose which dimensions should be reduces as either horizontal, vertical or both. Every other point is thrown away when reducing. z Zoom Use the arrow keys to move around a window covering one fourth of the picture to choose which part to enlarge two times. The shift keys can be used to position the window with pixel accuracy. When you are satisfied, press the key. At any time any other key aborts zooming. cu Cut Cuts out a rectangular area of the image. A crosshair can be moved around as described under "zoom" above to select first the top left corner and then the bottom right corner. Selection is by the key. The crosshair can be moved outside the screen area if the complete image is too large to fit on screen. The coordinates shown on screen will still show the correct values, but the crosshair itself will of course not be visible. r Rotate Rotate the original (not the new) image any integer angle, from -180 to 180 degrees, counter clockwise. Any changes done to the new image are lost, so you'll be asked to confirm the operation if the new image is the current one. mi Mirror You can mirror the image horizontally or vertically. x Shear (not shown on help screens) Shear image horizontally or vertically a specified amount. This is not really documented yet. y Scale (not shown on help screens) Scale image horizontally or vertically to a specified size. This is not really documented yet. Point Processes hi Histogram equalization This operation attempts to smooth out images with skewed or narrow histograms. The intensity values are redistributed to match their occurence frequency. i Inversion This is a bit more general than a simple digital negative. A threshold value is needed and this is used as follows: threshold == 0: new[i] = 255 - old[i] Invert pixel threshold < 0: if old[i] < -threshold Old intesity < -threshold? new[i] = 255 - old[i] yes, invert pixel else new[i] = old[i] no, don't change threshold > 0: if old[i] > threshold Old intensity > threshold? new[i] = 255 - old[i] yes, invert pixel else new[i] = old[i] no, don't change l Logarithmic scaling Scale each pixel's value to the ratio of the logarithm of the pixel's intensity and the maximum intesity in the image. t Threshold Makes all pixels above a given threshold intensity white and all below the threshold black. co Contrast expansion Attempts to expand the contrast of an image to cover the entire range of 256 allowable grey scales. A threshold value is used to remove intesity levels at the top and bottom of the histogram. The histogram is searched from the top and bottom for the first intensity level with more pixels than the threshold. The pixel intensities are then changed as follows: new[i] = 255 * (old[i] - low) / (high - low) where [low,high] is the new contrast range br Brighten A constant intensity is added to every pixel. A positive number brightens the image and a negative darkens it. Any new values outside the range 0-255 are limited to these values. Area Processes bl Blur Each pixels intensity value is changed to the mean of the nine pixels in the surrounding 3x3 square. me Median Each pixels intensity value is changed to the median of the nine pixels in the surrounding 3x3 square. v Convolution filters Apply one of a number of 3x3 convolutions to an image. Choose one of the built-in filters or enter 0 for user defined. In the latter case, enter the nine numbers of the convolution kernel along with a flag if there will be a multiplier (or divisor). Then enter that scaling factor if needed. All quantities are integers. Each pixels intensity value is changed to a value calculated by multiplying the pixel intensities of the pixels in the surrounding 3x3 square by the corresponding factor in the kernel matrix and summing these up. If a multiplier or divisor is used this is also applied to the new intensity. FILES *.GIF GIF image files. *.JPG JPEG (JFIF) image files. *.JPE - " - *.PI1 Degas low resolution files. *.PI2 Degas medium resolution files. *.FL MGIF flicker files. SEE ALSO gif(5) Gonzales and Wintz, Digital Image Processing. Lindley, Practical Image Processing In C. Burger and Gillies, Interactive Computer Graphics. Anil K Jain, Fundamentals of Digital Image Processing. Foley/Van Dam, Computer Graphics: principles and practice. DIAGNOSTICS Various warnings when corrupt files are given as input, when memory is insufficient etc. If an error occurs during a processing function, the prompt line will indicate the error. NOTES This program is still under development and all comments or suggestions for improvements are welcome. The complete sources for this program are available. Contact me if you're interested and can't find them. Sources tested on: GNU C 2.4.4, Lattice C 5.52, Turbo C 1.0 BUGS Please, report any bugs you find to me (Johan) at the address below. Logarithmic scaling needs real logarithms. The flicker file format is not fully defined. TODO (in priority order) Batch operation using MiNT pipes. Better support for extra grey scales on colour monitor. Use of the DSP in the Falcon030 for image processing and unpacking. GUI using GEM. And of course any good suggestions I get from you. AUTHORS Johan Klockars (d8klojo@dtek.chalmers.se) Current developer. Bill Rosenkranz (rosenkra@convex.com) Original author! Frank M”hle Added JPEG support. Klaus Pedersen (micro@imada.dk) Wrote original flicker code. Howard Chu Added overscan support etc. VERSION mgif 4.2 93-07-01