/*****************************************************************************/
/*
 *      Gmosaic.c  -- Gray Scale Mosaic
 *
 *      Copyright (C) 1999 Jim Buzbee ( jbuzbee@nyx.net )
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      For a copy of the GNU General Public License write to the Free Software
 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
/*****************************************************************************/
 

This program was inspired by the work of Robert Silvers whose software creates
an image made up of a "mosaic" of other images. Gmosaic is a more simplistic
program that will create a gray scale mosaic of an input image using either
a specified image "tile" or a tile created from the input image itself. Each
tile in the output image has its overall intensity adjusted to match the 
intensity of the corresponding pixel in the input image.   

At this time, the only format image that can be used is PGM in either raw or 
ASCII format. The output image will be in raw PGM format, unless a compile-time
flag is set for ASCII. Gmosaic can generate a image tile from the input image, 
but for best results a tile should be "hand-crafted" either from the input 
image or from another image.   Take caution when creating an image as it is 
very easy to accidently generate a huge output image. For example, trying to 
use an input image of 640x480 with a tile of 64x64 will result in Gmosaic 
attempting to create an image of size 640*64x480*64, e.g. a 40960x30720 
image which would likely exhaust the memory of the system. 

Usage : Gmosaic [-a value] [-t tile] [-s size] 
        [-o file] [-d] [-h] [file] 

Options :
	-a value	: Adjust the output intensity by this factor, i.e.
			  1.2, 0.5 etc.

	-d		: Debug. If this flag is specified, some
			  debug type messages will be written to stderr.

	-h		: Generate usage statement

	-o file		: Output file.  The file will be written in
			  PGM format.  If the output file is not specified
			  the image will be written to standard out.

	-s size		: Size of the tile to be used when Gmosaic 
			  generates a tile from the input image. The
			  value specifies the width of the tile and
			  should be a small number such as 20 or 22.

	-t tile		: A PGM format tile image that will be used to
			  compose the output image.  This should be a
			  fairly small image, i.e. 24x24, 15x15 etc. and
			  should be "square" or else the output image
			  will have an incorrect aspect ratio.

        File		: Input file.  The only supported input file
			  format is PGM in either raw or ASCII format.
			  If the input file is not specified, the image
			  will be read from standard input.

