[comp.sources.unix] v19i047: FBM, image manipulation library, Part01/08

rsalz@uunet.uu.net (Rich Salz) (06/09/89)

Submitted-by: Michael.Mauldin@NL.CS.CMU.EDU
Posting-number: Volume 19, Issue 47
Archive-name: fbm/part01

The Fuzzy Pixmap Manipulation (FBM) library of programs, in combination
with Jef Poskanzer's PBM collection, provides a complete package for
manipulating and converting color and black and whites images,
including 24bit RGB, 8bit mapped color, 8bit grayscale, and 1bit
bitmapped images.

The tools include:
	clr2gray  Convert color to grayscale
	fbcat	  Copy image (used for format conversion)
	fbclean	  Flip isolated pixels (clean image)
	fbedge	  Compute derivative image (edge detection)
	fbext	  Extract region, resize, change aspect ratio
	fbhalf	  Halftone grayscale image (Blue noise, Floyd-Steinberg, etc)
	fbhist	  Compute histogram
	fbinfo	  Dump image header
	fbm2pod	  Convert grayscale image to Diablo graphics (!)
	fbmask	  Set region to gray value
	fbnorm	  Normalize image intensity / increase contrast
	fbps	  Convert to PostScript
	fbquant	  Color quantization (24 bit to 8..256 colors) Mod. Heckbert
	fbrot	  Rotate 90, 180, or 270 degrees
	fbsample  Sample a 1bit file to produce an 8bit file
	fbsharp	  Sharpen (edge enhancement) by digital Laplacian
	gray2clr  Add a "gray" colormap to a grayscale image
	idiff	  (and udiff) convert raw byte stream into byte difference
	pbm2ps	  Convert PBM file to PostScript
	pbmtitle  Add a title to a PBM file
	raw2fbm	  Convert raw file to FBM format (eg: Amiga Digiview files)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 8)."
# Contents:  MANIFEST README README.lib clr2gray.1 fbclean.1 fbedge.1
#   fbham.1 fbhist.1 fbinfo.1 fbm2pod.1 fbm2tga.c fbmask.1 fbnorm.1
#   fbps.1 fbrot.1 fbsharp.1 flalfb.c flpic.c gray2clr.1 idiff.1
#   idiff.c pbm2ps.1 pbmtitle.1 pbmtitle.c pic2fbm.c qrt2fbm.1
#   raw2fbm.1 tga2fbm.c
# Wrapped by rsalz@fig.bbn.com on Fri Jun  9 08:38:19 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(2638 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X Features                   3	
X MANIFEST                   1	
X Makefile                   6	
X README                     1	
X README.lib                 1	
X clr2gray.1                 1	
X clr2gray.c                 2	
X fbcat.1                    2	
X fbcat.c                    2	
X fbclean.1                  1	
X fbclean.c                  2	
X fbedge.1                   1	
X fbedge.c                   2	
X fbext.1                    2	
X fbext.c                    5	
X fbhalf.1                   3	
X fbhalf.c                   4	
X fbham.1                    1	
X fbham.c                    7	
X fbhist.1                   1	
X fbhist.c                   2	
X fbinfo.1                   1	
X fbinfo.c                   2	
X fbm.1                      4	
X fbm.h                      3	
X fbm2pod.1                  1	
X fbm2pod.c                  4	
X fbm2tga.c                  1	
X fbmask.1                   1	
X fbmask.c                   2	
X fbnorm.1                   1	
X fbnorm.c                   3	
X fbps.1                     1	
X fbps.c                     5	
X fbquant.1                  2	
X fbquant.c                  8	
X fbrot.1                    1	
X fbrot.c                    2	
X fbsample.1                 2	
X fbsample.c                 3	
X fbsharp.1                  1	
X fbsharp.c                  2	
X flalfb.c                   1	
X flblue.c                   4	
X flbyte.c                   3	
X flcavg.c                   2	
X flclr.c                    5	
X fledge.c                   5	
X flextr.c                   4	
X flface.c                   3	
X flflyd.c                   3	
X flgifc.c                   6	
X flgife.c                   4	
X flgifr.c                   7	
X flgifw.c                   3	
X fliff.c                    7	
X flklnr.c                   5	
X flpbm.c                    4	
X flpcx.c                    6	
X flpic.c                    1	
X flrdfb.c                   3	
X flread.c                   3	
X flrot.c                    4	
X flshrp.c                   4	
X flsun.c                    5	
X fltga.c                    6	
X flthre.c                   2	
X flwrfb.c                   2	
X gray2clr.1                 1	
X gray2clr.c                 2	
X idiff.1                    1	
X idiff.c                    1	
X pbm2ps.1                   1	
X pbm2ps.c                   5	
X pbmtitle.1                 1	
X pbmtitle.c                 1	
X pic2fbm.c                  1	
X qrt2fbm.1                  1	
X qrt2fbm.c                  2	
X raw2fbm.1                  1	
X raw2fbm.c                  3	
X tga2fbm.c                  1	
END_OF_FILE
if test 2638 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(5911 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XThis directory contains the Beta test release (version 0.9) of the
XFuzzy Pixmap Manipulation (FBM) library of programs.  This collection
X(in combination with Jef Poskanzer's PBM collection) provides a
Xcomplete package for manipulating and converting color and black and
Xwhites images, including 24bit RGB, 8bit mapped color, 8bit grayscale,
Xand 1bit bitmapped images.
X
XCompilation
X
X	Unpack all files in one directory.  Edit Makefile and put in
X	appropriate values for 
X
XFile Formats
X
X	FBM   (-F)	FBM file with 256 byte header (with title & credits)
X	Sun   (-S)	Sun rasterfile with 32 byte header
X	PBM   (-P)	Poskanzer format for 1bit files
X	GIF   (-G)	CompuServe GIF format
X	IFF   (-I)	Amiga IFF files (except HAM mode files)
X	PCX   (-Z)	PC PaintBrush format for IBM
X	Face  (-B)	Bennet Yee's 1bit files, used at CMU
X
X	All programs (except fbinfo) can read any of the formats, and use
X	the magic number to decide the file type.  If the input is not a
X	pipe and is compressed using the net standard 'compress' program,
X	the file will be uncompressed as it is read.  Note however that 
X	the operation to be performed must make sense; that is you cannot
X	halftone a color image, quantize a grayscale image, or resize a
X	1bit file.
X
XFiles and Programs:
X
X	README		This file
X	README.lib	Lists the subroutines in libfbm.a
X	Makefile	Make utility configuration file
X	fbm.1		General manual entry
X	*.1		Individual manual entries
X	fbm.h		Defines FBM data structures
X
X	clr2gray  Convert color to grayscale
X	fbcat	  Copy image (used for format conversion)
X	fbclean	  Flip isolated pixels (clean image)
X	fbedge	  Compute derivative image (edge detection)
X	fbext	  Extract region, resize, change aspect ratio
X	fbhalf	  Halftone grayscale image (Blue noise, Floyd-Steinberg, etc)
X	fbhist	  Compute histogram
X	fbinfo	  Dump image header
X	fbm2pod	  Convert grayscale image to Diablo graphics (!)
X	fbmask	  Set region to gray value
X	fbnorm	  Normalize image intensity / increase contrast
X	fbps	  Convert to PostScript
X	fbquant	  Color quantization (24 bit to 8..256 colors) Mod. Heckbert
X	fbrot	  Rotate 90, 180, or 270 degrees
X	fbsample  Sample a 1bit file to produce an 8bit file
X	fbsharp	  Sharpen (edge enhancement) by digital Laplacian
X	gray2clr  Add a "gray" colormap to a grayscale image
X	idiff	  (and udiff) convert raw byte stream into byte difference
X	pbm2ps	  Convert PBM file to PostScript
X	pbmtitle  Add a title to a PBM file
X	raw2fbm	  Convert raw file to FBM format (eg: Amiga Digiview files)
X
X
X
XExtensions
X
X	Several file extension conventions are used, but none are enforced
X
X	.Z		Compressed file, appended to other extensions
X
X	.fbm		Standard extension for FBM format files
X	.cbm		Sometimes used to mean a 24bit color FBM file
X
X	.ip		8bit grayscale Amiga file (with 1.2 aspect ratio)
X	.cp		24bit color Amiga file (with 1.2 aspect ratio)
X
X	.1bit		Sun 1bit rastefile
X	.clr		Sometimes used to mean a 8bit mapped color Sun file
X
X	.bm		Bennet Yee's "Face" format (1bit)
X	.pbm		Poskanzer 1bit format
X	.gif		Compuserve GIF format
X	.pcx		ZSoft's PCPaintbrush format
X
XExample Unix pipelines to view files:
X
X	Starting with an 8 bit raw Amiga grayscale file, foo.ip, first
X	create an FBM format file with a title and credit, then process
X	that file for viewing on a Sun screen by normalizing, rotating,
X	resizing, sharpening, and halftoning.
X
X	% raw2fbm -d1 -a1.2 -w640 -h400 \
X	  -t'Random Title' -c'Random Credit' < foo.ip > foo.fbm
X
X	% fbinfo foo.fbm
X	foo.fbm        	"Random Title"
X			[ Random Credit ]
X			[640x400x8]    8 physbits  1.2 aspect ratio
X			row length 640, plane length 256000, colormap length 0
X
X
X	% fbnorm < foo.fbm | \			(normalize)
X	  fbrot | \				(rotate 90 deg clockwise)
X	  fbext -a1 -W900 -H768 | \		(resize & make aspect ratio 1)
X	  fbhalf -s10 -S > foo.1bit		(sharpen, halftone, write Sun)
X
X
X
X	Starting with a 24 bit color Amiga file, bar.cp, first create an
X	FBM format file with title and credit, then render that file for
X	viewing on a Sun by normalizing, rotating, sharpening, and
X	quantizing.
X
X	% raw2fbm -d3 -a1.2 -w640 -h400 \
X	  -t'Random Color Title' -c'Random Color Credit' < bar.cp > bar.cbm
X
X	% fbinfo bar.cbm
X	bar.cbm        	"Random Color Title"
X			[ Random Color Credit ]
X			[3x640x400x8]    8 physbits  1.2 aspect ratio
X			row length 640, plane length 256000, colormap length 0
X
X
X	% fbnorm < bar.cbm | \			(normalize)
X	  fbrot | \				(rotate 90 deg clockwise)
X	  fbext -a1 -W900 -H768 | \		(resize & make aspect ratio 1)
X	  fbsharp 3.0 | \			(sharpen it)
X	  fbquant -S > bar.clr			(quantize and write Sun)
X
X	(Note that sharpening is an integral option to the halftoning
X	 program using the -s option, but that color images must currently
X	 be sharpened using a separate program.  Note also that more
X	 sharpening is used on black and white images than on color images).
X
XNotes on the 'fbext' program
X
X	Usage:	fbext [ -w<width> -h<height> -W<maxwdith> -H<maxheight>
X		        -s<size> -a<aspect> -t'title' -c'credits' ]
X		     [ x y [ width height ] ]
X		< foo.fbm > bar.fbm
X
X	fbext (bitmap extract) is a very useful anmd multipurpose program.
X	Its basic operation is to copy a rectangular portion of one image
X	(color or black and white) to a second image, possibly changing
X	either the width or height or both.  It can also change the title
X	or credits fields of the image.  Because it is so versatile, there
X	are a host of options:
X
X	-w<num>  or  -h<num>	Force width and/or height to a certain size
X	-W<num>  or  -H<num>	Limit width and height to a certain size
X	-a<num>			Force the output to have a given aspect ratio
X	-s<num>			Scale image to have no more than a given
X				number of pixels.
X	<x0> <y0> <width> <height>  select a rectangular region of the image
X				to extract.  The default is the entire image.
X
X	Note that the output size limits are cumulative.  Thus if you set a
X	maximum width, height, and number of pixels, the image will be the
X	smallest of the three limits.
X
END_OF_FILE
if test 5911 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'README.lib' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README.lib'\"
else
echo shar: Extracting \"'README.lib'\" \(1823 characters\)
sed "s/^X//" >'README.lib' <<'END_OF_FILE'
XThis directory contains the source for the FBM bitmap manipulation
Xlibrary.  The commands implemented allow for resizing, retoning and
Xrendering of both grayscale and color bitmaps, as well as conversions
Xto and from a variety of other formats including PBM, Bennet Yee's
XFACE format, and Sun rasterfiles.
X
XSeparate compilation files for libfbm.a:
X
X	flalfb.c: 
X		alloc_fbm (image)
X		free_fbm (image)
X	flblue.c: 
X		bluenoise_fbm (input, output, noiselevel)
X	flbyte.c:
X		get_long (rfile, order)
X		get_short (rfile, order)
X		put_long (long, wfile, order)
X		put_short (word, wfile, order)
X		machine_byte_order ()
X	flcavg.c: 
X		constravg_fbm (input, output, gamma)
X	flclr.c:
X		clr2gray (input, output, rw, gw, bw)
X		gray2clr (input, output, rw, gw, bw)
X	fledge.c:
X		findedge_fbm (&image, beta)
X	flextr.c: 
X		extract_fbm (input, output, xo, yo, w, h, ow, oh,
X			     title, credits)
X	flface.c: 
X		write_face (image, stream)
X		read_face (image, stream , mstr, mlen)
X	flflyd.c: 
X		floyd_fbm (input, output)
X	flgifc.c:
X	flgife.c:
X	flgifr.c:
X		read_gif (image, infile, mstr, mlen)
X	flgifw.c:
X		write_gif (image, infile)
X	fliff.c:
X		read_iff (image, infile, mstr, mlen)
X		write_iff (image, infile)
X	flklnr.c:
X		clean_fbm (input, output, beta, gamma, nbr)
X	flpbm.c: 
X		read_pbm (image, infile, mstr, mlen)
X		write_pbm (image, stream)
X	flpcx.c:
X		read_pcx (image, rfile, mstr, mlen)
X	flrdfb.c: 
X		read_fbm (image, rfile, mstr, mlen)
X		read_hdr_fbm (image, rfile, mstr, mlen)
X	flread.c:
X		read_bitmap (image, rfname)
X		write_bitmap (image, wfile, type)
X	flrot.c:
X		rotate_fbm (input, output, rot)
X	flshrp.c: 
X		sharpen_fbm (input, output, beta)
X	flsun.c:
X		read_sun (image, rfile, mstr, mlen)
X		write_sun (image, wfile)
X	flhtre.c:
X		thesh_fbm (input, output, thresh)
X	flwrfb.c: 
X		write_fbm (image, wfile)
X		write_hdr_fbm (image, wfile)
END_OF_FILE
if test 1823 -ne `wc -c <'README.lib'`; then
    echo shar: \"'README.lib'\" unpacked with wrong size!
fi
# end of 'README.lib'
fi
if test -f 'clr2gray.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'clr2gray.1'\"
else
echo shar: Extracting \"'clr2gray.1'\" \(1853 characters\)
sed "s/^X//" >'clr2gray.1' <<'END_OF_FILE'
X.TH CLR2GRAY 1 07-Mar-89
X.CM 3
X.SH NAME
Xclr2gray \- Convert color images to grayscale
X.SH SYNOPSIS
X.nf
Xclr2gray [ -r<red> -g<grn> -b<blu> ] [ -<type> ] < color > gray
X.fi
X.SH DESCRIPTION
X.PP
XConverts a color image (8bit or 24bit) to an 8 bit grayscale image.
XIt works for both mapped and unmapped color inputs.
X.SH OPTIONS
X.TP
X.BR -r<num>, -g<num>, -b<num>
X.I weights,
Xused to convert the triple <red,green,blue> to a scalar intensity
Xvalue.  If one or more weights are specified, those not specified
Xdefault to zero.   If no weights are specified, NTSC weights (29.9%
Xred, 58.7% green, 11.4% blue) are used.
X.TP
X.BR -B
X.I face
Xformat, as used by Bennet Yee's
X.I face
Xprogram at CMU. 
X.TP
X.BR -F
X.I FBM,
Xformat (by default, the default).  You are guaranteed not
Xto lose information by specifying FBM as the default.
X.TP
X.BR -G
X.I GIF,
XCompuserve GIF format.
X.TP
X.BR -I
X.I IFF
Xformat, interleaved bitmaps (ILBM), used by Amigas.
X.TP
X.BR -P
X.I PBM,
XJef Poskanzer's bitmap format.
X.TP
X.BR -S
X.I sun,
XSun rasterfiles (not run length encoded).
X.SH EXAMPLE
X.PP
XTo convert a mapped color image in FBM format to a Sun
Xformat grayscale image:
X.sp
X	% clr2gray -S < foo.fbm > foo.8bit
X.sp
XTo extract the red color plane from an image and write the result in
XFBM format:
X.sp
X	% clr2gray -r1 -F < foo.fbm > red.fbm
X.sp
XNote that since the green and blue weights were not specified, they
Xdefaulted to 0, and the result is that only the red plane is used.
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1853 -ne `wc -c <'clr2gray.1'`; then
    echo shar: \"'clr2gray.1'\" unpacked with wrong size!
fi
# end of 'clr2gray.1'
fi
if test -f 'fbclean.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbclean.1'\"
else
echo shar: Extracting \"'fbclean.1'\" \(1918 characters\)
sed "s/^X//" >'fbclean.1' <<'END_OF_FILE'
X.TH FBCLEAN 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbclean \- flip isolated pixels in a 1bit image
X.SH SYNOPSIS
X.nf
Xfbclean [ -b<cleaner> -t<threshhold> -n<nbr> ] [ -<type> ] < bitmap > bitmap
X.fi
X.SH DESCRIPTION
X.PP
XFlips isolated pixels (this can be used to clean up "snow" in some
Xhalftoned images.  Can also convert a grayscale image to bitmap by
Xtheshholding before the cleaning is done.
X.SH OPTIONS
X.TP
X.B -b
X.I cleaner
Xoption, specifies the minimum number of "nearby" like pixels to remain
Xthe same color.
X.TP
X.B -n
X.I neighbors,
Xthe size of the neighborhood.  To be "nearby" means to be located in an
XNxN square around the target pixel.
X.TP
X.B -t
X.I threshhold
Xcommand, used to halftone the image before cleaning.  The default is no
Xtheshholding.
X.TP
X.BR -B
X.I face
Xformat, as used by Bennet Yee's
X.I face
Xprogram at CMU. 
X.TP
X.BR -F
X.I FBM,
Xformat (by default, the default).  You are guaranteed not
Xto lose information by specifying FBM as the default.
X.TP
X.BR -G
X.I GIF,
XCompuserve GIF format.
X.TP
X.BR -I
X.I IFF
Xformat, interleaved bitmaps (ILBM), used by Amigas.
X.TP
X.BR -P
X.I PBM,
XJef Poskanzer's bitmap format.
X.TP
X.BR -S
X.I sun,
XSun rasterfiles (not run length encoded).
X.PP
X.SH EXAMPLE
X.PP
XTo take a bitmap and clean up pixels with fewer than 2 like neighbors
Xin the surrounding 5x5 square, outputing s Sun rasterfile:
X.sp
X   % fbclean -S -b2 -n5 < foo.1bit > bar.1bit
X.sp
XTo do the same thing to a grayscale file (threshholding first with 128):
X.sp
X    % fbclean -S -b2 -n5 -t128 < foo.1bit > bar.1bit
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1918 -ne `wc -c <'fbclean.1'`; then
    echo shar: \"'fbclean.1'\" unpacked with wrong size!
fi
# end of 'fbclean.1'
fi
if test -f 'fbedge.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbedge.1'\"
else
echo shar: Extracting \"'fbedge.1'\" \(1547 characters\)
sed "s/^X//" >'fbedge.1' <<'END_OF_FILE'
X.TH FBEDGE 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbedge \- compute the derivative of an image (edge detection)
X.SH SYNOPSIS
X.nf
Xfbedge [ -t<threshhold> ] [ -<type> ] < bitmap > bitmap
X.fi
X.SH DESCRIPTION
X.PP
XComputes a halftoned image composed of edges in the original.  Edge
Xdetection is done by digital Laplacian.
X.SO OPTIONS
X.TP
X.B -t<num>
X.I threshhold
Xargument, specifies a threshhold for detecting edges.  Pixels with
Xfirst derivatives greater than the threshhold will be black, and others
Xwill be white.
X.TP
X.BR -B
X.I face
Xformat, as used by Bennet Yee's
X.I face
Xprogram at CMU. 
X.TP
X.BR -F
X.I FBM,
Xformat (by default, the default).  You are guaranteed not
Xto lose information by specifying FBM as the default.
X.TP
X.BR -G
X.I GIF,
XCompuserve GIF format.
X.TP
X.BR -I
X.I IFF
Xformat, interleaved bitmaps (ILBM), used by Amigas.
X.TP
X.BR -P
X.I PBM,
XJef Poskanzer's bitmap format.
X.TP
X.BR -S
X.I sun,
XSun rasterfiles (not run length encoded).
X.SH EXAMPLE
X.PP
XTo produce an image of regions in a grayscale image where the first
Xderivative is greater than 10, and output the result as a Sun
Xrasterfile:
X.sp
X    % fbedge -t10 -S < foo.gray > foo.1bit
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1547 -ne `wc -c <'fbedge.1'`; then
    echo shar: \"'fbedge.1'\" unpacked with wrong size!
fi
# end of 'fbedge.1'
fi
if test -f 'fbham.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbham.1'\"
else
echo shar: Extracting \"'fbham.1'\" \(1502 characters\)
sed "s/^X//" >'fbham.1' <<'END_OF_FILE'
X.TH FBHAM 1 20-May-89
X.CM 3
X.SH NAME
Xfbham \- Convert 24 bit RGB color to Amiga HAM mode
X.SH SYNOPSIS
X.nf
Xfbham < image.cbm > image.ham
X.fi
X.SH DESCRIPTION
X.PP
X.I fbham
Xreads a 24bit color image and produces Amiga HAM mode.  The output is
Xan IFF ILBM file with 6 planes.  The first two bits of a pixel specify
Xan operation and the last four bits specify a color.  The operations
Xare:
X.sp
X.nf
X   00	Use the 4bit value as in index into the color table.
X   01	Copy the RGB values for the pixel to the immediate left,
X  	using the 4bit value to change the intensity of the red
X	gun.  The new red value will be the 4bit value shifted
X	left 4 bits (so 0,1,...15 maps to 0,16,...240).
X   02	Same as above, but change green gun.
X   03	Same as above, but change blue gun.
X.fi
X.sp
XIf your input image is not 24 bits, use unmap(1) to convert almost any
Xcolor image to 24 bits.
X.SH OPTIONS
X.PP
XNone.
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XReally lousy choice for initial colormap.  Should use the
Xbuild_colormap routine from fbquant.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X20-May-89  Michael L. Mauldin at Carnegie Mellon University
XWrote this man page.  Software by C. Harald Koch (chk) at DCIEM Toronto
X<chk@ben.dciem.dnd.ca>, based on ray2.c from DBW_Render, Copyright 1987
XDavid B. Wecker.
END_OF_FILE
if test 1502 -ne `wc -c <'fbham.1'`; then
    echo shar: \"'fbham.1'\" unpacked with wrong size!
fi
# end of 'fbham.1'
fi
if test -f 'fbhist.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbhist.1'\"
else
echo shar: Extracting \"'fbhist.1'\" \(1561 characters\)
sed "s/^X//" >'fbhist.1' <<'END_OF_FILE'
X.TH FBHIST 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbhist \- compute histogram of an image
X.SH SYNOPSIS
X.nf
Xfbhist [ -h ] < image
X.fi
X.SH DESCRIPTION
X.PP
XPrints some of the header info and displays the maximum, minimum, mean,
Xand standard deviation of the gray levels.  If given any argument it
Xalso dumps the histogram.  Works correctly for black and white images.
XOn color images it will work, but the results for images with odd
Xwidths will include the zeroes used to pad to an even byte boundary.
X.sp
X.TP
X.B -h
X.I histogram
Xargument requests printing the actual counts for all gray levels used
Xby the image.
X.SH EXAMPLE
X.PP
XTo compute the mean and range of an image:
X.sp
X.nf
X    % fbhist < tiger.fbm
X    Tiger [400x640  8 bits  0.833 aspect ratio]
X    Mean 88.83 +- 40.94, range 21..201
X.fi
X.sp
XThe output shows that the image is title 'Tiger', and that it is 400
Xpixels wide and 640 pixels tall.  The pixels are 8 bits deep, and the
Ximage has a 0.833 aspect ratio (it is a rotated version of a 1.2 to 1
Ximage).  The average density is 88.83 with a standard deviation of
X40.94.  Pixels range from values 21 (darkest) to 201 (lightest) out of
Xa 0..255 range.
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1561 -ne `wc -c <'fbhist.1'`; then
    echo shar: \"'fbhist.1'\" unpacked with wrong size!
fi
# end of 'fbhist.1'
fi
if test -f 'fbinfo.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbinfo.1'\"
else
echo shar: Extracting \"'fbinfo.1'\" \(966 characters\)
sed "s/^X//" >'fbinfo.1' <<'END_OF_FILE'
X.TH FBINFO 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbinfo \- dump the contents of an FBM image header
X.SH SYNOPSIS
X.nf
Xfbinfo files...
X.fi
X.SH DESCRIPTION
X.PP
XDump the header information  of one or more files.  If the file name
Xends in ".Z", the file is uncompressed before the header is read.
XNote that compressed files that don't have ".Z" at the end won't work.
X.SH EXAMPLE
X.PP
Xfbinfo *.fbm
X.PP
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XShould be expanded to work for all readable image formats.  As a work
Xaround you can use fbhist(1) which does read all formats (using
Xsignificantly more time and cpu).
X
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 966 -ne `wc -c <'fbinfo.1'`; then
    echo shar: \"'fbinfo.1'\" unpacked with wrong size!
fi
# end of 'fbinfo.1'
fi
if test -f 'fbm2pod.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbm2pod.1'\"
else
echo shar: Extracting \"'fbm2pod.1'\" \(1122 characters\)
sed "s/^X//" >'fbm2pod.1' <<'END_OF_FILE'
X.TH FBM2POD 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbm2pod \- convert grayscale to Diablo graphics
X.SH SYNOPSIS
X.nf
Xfbm2pod [ -fbc<parm> ] [-s<sharpen> ] [ size ] < 8bit > pod
X.fi
X.SH DESCRIPTION
X.PP
XEquivalent to
X.I fbhalf,
Xbut generates a file for the Diablo printer at 30 dpi horizontal and 24
Xdpi vertical.
X.SH EXAMPLE
X.PP
XGiven a grayscale image, reproduce it on a Diablo printer.  Use blue
Xnoise dithering and size the output for about 25,000 pixels (around 5x7
Xinches on a Diablo).  Use sharpening with beta=10 to enhance edges:
X.sp
X    % fbm2pod -s10 25000 < foo.8bit > foo.pod
X.sp
XAt CMU, the podtype(1) command is used to send files to Diablo printers.
X.SH SEE ALSO
Xfbhalf(1) for options,
Xpodtype(1) for printing on Diablos,
Xfbm(1) for general discussion,
Xpbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1122 -ne `wc -c <'fbm2pod.1'`; then
    echo shar: \"'fbm2pod.1'\" unpacked with wrong size!
fi
# end of 'fbm2pod.1'
fi
if test -f 'fbm2tga.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbm2tga.c'\"
else
echo shar: Extracting \"'fbm2tga.c'\" \(1295 characters\)
sed "s/^X//" >'fbm2tga.c' <<'END_OF_FILE'
X/*****************************************************************
X * fbm2tga.c: FBM Library 0.93 (Beta test) 03-May-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * fbm2tga.c: convert a bitmap to Targa format
X *
X * USAGE
X *	% fbm2tga [ image ] > image.tga
X *
X * EDITLOG
X *	LastEditDate = Wed May  3 21:50:43 1989 - Michael Mauldin
X *	LastFileName = /usr2/mlm/src/misc/fbm/fbm2tga.c
X *
X * HISTORY
X * 03-May-89  Michael Mauldin (mlm) at Carnegie Mellon University
X *	Beta release (version 0.93) mlm@cs.cmu.edu
X *****************************************************************/
X
X# include <stdio.h>
X# include <math.h>
X# include "fbm.h"
X
X# define USAGE\
X"Usage: fbm2tga [ image ] > image.tga"
X
X#ifndef lint
Xstatic char *fbmid =
X	"$FBM fbm2tga.c <0.93> 03-May-89  (C) 1989 by Michael Mauldin$";
X#endif
X
Xmain (argc,argv)
Xint argc; char *argv[];
X{ FBM image;
X
X  /* Clear pointers */
X  image.cm = image.bm = (unsigned char *) NULL;
X
X  /* Read anything, write targa */
X  if (read_bitmap (&image, (argc > 0) ? *argv : (char *) NULL) &&
X      write_tga (&image, stdout))
X  {
X    exit (0);
X  }
X  else
X  { exit (1); }
X}
END_OF_FILE
if test 1295 -ne `wc -c <'fbm2tga.c'`; then
    echo shar: \"'fbm2tga.c'\" unpacked with wrong size!
fi
# end of 'fbm2tga.c'
fi
if test -f 'fbmask.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbmask.1'\"
else
echo shar: Extracting \"'fbmask.1'\" \(1076 characters\)
sed "s/^X//" >'fbmask.1' <<'END_OF_FILE'
X.TH FBMASK 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbmask \- mask a rectangle in a grayscale file
X.SH SYNOPSIS
X.nf
Xfbmask [ -<type> ] x0 y0 x1 y1 value < 8bit > 8bit
X.fi
X.SH DESCRIPTION
X.PP
XPaints the specified gray value
X.I val
Xin a rectangle starting at
X.I x
Xand
X.I y
Xwith the given 
X.I width
Xand
X.I height.
X.PP
X.SH EXAMPLE
XTo put a 50 pixel wide black border around a 640 by 480 pixel grayscale
Ximage, you could use the following pipeline (which outputs a Sun
Xrasterfile):
X.sp
X.nf
X    % fbmask   0   0  50 480 0 < foo.8bit |
X      fbmask   0   0 640  50 0 < foo.8bit |
X      fbmask   0 430 640 480 0 < foo.8bit |
X      fbmask 590   0 640 480 0 < foo.8bit > bar.8bit
X.fi
X.sp
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1076 -ne `wc -c <'fbmask.1'`; then
    echo shar: \"'fbmask.1'\" unpacked with wrong size!
fi
# end of 'fbmask.1'
fi
if test -f 'fbnorm.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbnorm.1'\"
else
echo shar: Extracting \"'fbnorm.1'\" \(1749 characters\)
sed "s/^X//" >'fbnorm.1' <<'END_OF_FILE'
X.TH FBNORM 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbnorm \- normalize and adjust grayscale or color image
X.SH SYNOPSIS
X.nf
Xfbnorm [ -b<val> -w<val> ] [ -<type> ] < image > image
X.fi
X.SH DESCRIPTION
X.PP
XExtends the contrast range to a full 0 to 255.  The arguments
X.B -b
Xand
X.B -w
Xgiven the percentage of the darkest pixels to map to black and lightest
Xpixels to map to white.
X.sp
XFor color images the default is to discard 0.5% each of the darkest and
Xlightest pixels.  Increasing the contrast beyond that may result in
Xsignificant color artifacts (because the color values will be partially
Xclipped).
X.SH OPTIONS
X.TP
X.BR -b<num>, -w<num>
X.I percentage black, white
Xpixels to map to 0, 255.  The default for grayscale images is to
X"discard" 2 percent of the black pixels and 1 percent of the white
Xpixels.  For color images both values default to 0.5 percent.
X.sp
XAn alternate form is to specify two integers, which will then be
Xlinearly mapped to 0 and 255.
X.SH EXAMPLE
X.PP
XTo normalize a grayscale FBM image using defaults:
X.sp
X    % fbnorm < foo.fbm > bar.fbm
X.sp
XTo increase contrast by discarding 10 percent of the black pixels and 5
Xpercent of the white pixels:
X.sp
X    % fbnorm -b10 -w5 < foo.fbm > bar.fbm
X.sp
XOr, if you know that you want 34 to map to 0 and 197 to map to 255, you
Xcan just type:
X.sp
X    % fbnorm 34 197 < foo.fbm > bar.fbm
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1749 -ne `wc -c <'fbnorm.1'`; then
    echo shar: \"'fbnorm.1'\" unpacked with wrong size!
fi
# end of 'fbnorm.1'
fi
if test -f 'fbps.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbps.1'\"
else
echo shar: Extracting \"'fbps.1'\" \(1658 characters\)
sed "s/^X//" >'fbps.1' <<'END_OF_FILE'
X.TH FBPS 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbps \- convert grayscale to postscript
X.SH SYNOPSIS
X.nf
Xfbps [-tT] [-pP] [ -s ] [ -w<width> ] < grayscale > foo.PS
X.fi
X.SH DESCRIPTION
X.PP
XConverts an fbm format file into a postscript file for printing. The
X.B -s
Xflag generates a file suitable for including in a postscript document
X(for example, Scribe or LaTex output) with no document structuring,
Xtitles, or trailing "showpage".  By default, the image's title is
Xprinted in a large font centered over the image, and a small banner
Xgiving the size is printed under the lower right corner.
XThe
X.B -T
Xand 
X.B -P
Xarguments disable the title and print size options.
X.sp
XThere really ought to be an option to print the credits instead of the
Xsize, but I haven't done it yet.
X.SH EXAMPLE
X.PP
XTo convert a Sun 8bit grayscale rasterfile to a full page postscript file:
X.sp
X	% fbps < foo.8bit > foo.PS
X.sp
XTo convert a color GIF file to a 3 inch wide grayscale postscript file
Xfor inclusion in a Scribe or TeX document:
X.sp
X	% clr2gray < foo.gif | fbps -s -w3.0 > foo.PS
X.sp
XTo print a 1 bit deep Sun rasterfile in postscript, use fbcat and
Xpbm2ps:
X.sp
X	% fbcat -P < foo.1bit | pbm2ps > foo.PS
X.SH SEE ALSO
Xfbcat(1) and pbm2ps(1) for converting 1 bit deep files to PostScript.
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1658 -ne `wc -c <'fbps.1'`; then
    echo shar: \"'fbps.1'\" unpacked with wrong size!
fi
# end of 'fbps.1'
fi
if test -f 'fbrot.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbrot.1'\"
else
echo shar: Extracting \"'fbrot.1'\" \(1311 characters\)
sed "s/^X//" >'fbrot.1' <<'END_OF_FILE'
X.TH FBROT 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbrot \- rotate an image 90, 180 or 270 degrees
X.SH SYNOPSIS
X.nf
Xfbrot [ -<type> ] [ -90 | -180 | -270 ] < bitmap > bitmap
X.fi
X.SH DESCRIPTION
X.PP
XRotate an image in increments of 90 degrees.
XThe direction is clockwise.
XThe default is 90 degrees clockwise.
X.SH OPTIONS
X.TP
X.B -90, -180, -270
Xamount of clockwise rotation  inb degrees.
X.TP
X.BR -B
X.I face
Xformat, as used by Bennet Yee's
X.I face
Xprogram at CMU. 
X.TP
X.BR -F
X.I FBM,
Xformat (by default, the default).  You are guaranteed not
Xto lose information by specifying FBM as the default.
X.TP
X.BR -G
X.I GIF,
XCompuserve GIF format.
X.TP
X.BR -I
X.I IFF
Xformat, interleaved bitmaps (ILBM), used by Amigas.
X.TP
X.BR -P
X.I PBM,
XJef Poskanzer's bitmap format.
X.TP
X.BR -S
X.I sun,
XSun rasterfiles (not run length encoded).
X.SH EXAMPLE
X.PP
XRotate a Sun rasterfile 90 degrees:
X.sp
X    % fbrot -90 -S < foo.1bit > bar.1bit
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1311 -ne `wc -c <'fbrot.1'`; then
    echo shar: \"'fbrot.1'\" unpacked with wrong size!
fi
# end of 'fbrot.1'
fi
if test -f 'fbsharp.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'fbsharp.1'\"
else
echo shar: Extracting \"'fbsharp.1'\" \(1795 characters\)
sed "s/^X//" >'fbsharp.1' <<'END_OF_FILE'
X.TH FBSHARP 1 07-Mar-89
X.CM 3
X.SH NAME
Xfbsharp \- edge enhance a grayscale or color image
X.SH SYNOPSIS
X.nf
Xfbsharp [ -<type> ] beta < image > image
X.fi
X.SH DESCRIPTION
X.PP
XUses a digital Laplacian filter to enhance the edges.  Typical values
Xof beta run from 1 to 20.  The default is 2.  This command works for
Xcolor images, but values of sharpening higher than 3 or 4 tend to create
Xlots of noisy artifiacts in the image.
X.sp
XThe
X.I fbhalf
Xcommand also calls the sharpening code implicitly if the
X.I -s
Xoptional is passed to
X.I fbhalf.
X.SH OPTIONS
X.TP
X.BR <beta>
Xspecifies the amount of sharpening.  Typical values run from 1 to 10,
Xhigher values can cause snow.
X.TP
X.BR -B
X.I face
Xformat, as used by Bennet Yee's
X.I face
Xprogram at CMU. 
X.TP
X.BR -F
X.I FBM,
Xformat (by default, the default).  You are guaranteed not
Xto lose information by specifying FBM as the default.
X.TP
X.BR -G
X.I GIF,
XCompuserve GIF format.
X.TP
X.BR -I
X.I IFF
Xformat, interleaved bitmaps (ILBM), used by Amigas.
X.TP
X.BR -P
X.I PBM,
XJef Poskanzer's bitmap format.
X.TP
X.BR -S
X.I sun,
XSun rasterfiles (not run length encoded).
X.SH EXAMPLE
X.PP
XSince the -s option of fbahlf(1) exists, you will probably only run
Xfbsharp on color images, which tolerate less sharpening.  Here we
Xsharpen an FBM format color image with beta=3 and quantize it for
Xdisplay on a Sun:
X.sp
X    % fbsharp 3.0 < foo.fbm | fbquant -S > foo.clr
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1795 -ne `wc -c <'fbsharp.1'`; then
    echo shar: \"'fbsharp.1'\" unpacked with wrong size!
fi
# end of 'fbsharp.1'
fi
if test -f 'flalfb.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'flalfb.c'\"
else
echo shar: Extracting \"'flalfb.c'\" \(2086 characters\)
sed "s/^X//" >'flalfb.c' <<'END_OF_FILE'
X/*****************************************************************
X * flalfb.c: FBM Library 0.9 (Beta test) 07-Mar-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * flalfb.c: Fuzzy bitmap allocation
X *
X * CONTENTS
X *	alloc_fbm (image)
X *	free_fbm (image)
X *
X * EDITLOG
X *	LastEditDate = Tue Mar  7 19:56:45 1989 - Michael Mauldin
X *	LastFileName = /usr2/mlm/src/misc/fbm/flalfb.c
X *
X * HISTORY
X * 07-Mar-89  Michael Mauldin (mlm) at Carnegie Mellon University
X *	Beta release (version 0.9) mlm@cs.cmu.edu
X *
X * 12-Nov-88  Michael Mauldin (mlm) at Carnegie-Mellon University
X *	Created.
X *****************************************************************/
X
X# include <stdio.h>
X# include <math.h>
X# include <ctype.h>
X# include "fbm.h"
X
X/****************************************************************
X * alloc_fbm: Allocate enough bytes for the bitmap and colormap
X *	of an image where the header has already been filled in.
X ****************************************************************/
X
X#ifndef lint
Xstatic char *fbmid =
X	"$FBM flalfb.c <0.9> 07-Mar-89  (C) 1989 by Michael Mauldin$";
X#endif
X
Xalloc_fbm (image)
XFBM *image;
X{ unsigned bmsize, cmsize;
X
X  if (! free_fbm (image)) return (0);
X
X  /* Calculate bytes needed */
X  bmsize = (image->hdr.planes * image->hdr.plnlen);
X  cmsize = image->hdr.clrlen;
X  
X  if (! (image->bm = (unsigned char *) malloc (bmsize)) ||
X      (cmsize && ! (image->cm = (unsigned char *) malloc (cmsize))))
X  { perror ("alloc_fbm"); exit (1); }
X
X  return (1);
X}
X
X/****************************************************************
X * free_fbm: Free the storage allocate by alloc_fbm
X ****************************************************************/
X
Xfree_fbm (image)
XFBM *image;
X{
X  if (image->bm)
X  { free ((char *) image->bm); image->bm = (unsigned char *) NULL; }
X
X  if (image->cm)
X  { free ((char *) image->cm); image->cm = (unsigned char *) NULL; }
X
X  return (1);
X}
END_OF_FILE
if test 2086 -ne `wc -c <'flalfb.c'`; then
    echo shar: \"'flalfb.c'\" unpacked with wrong size!
fi
# end of 'flalfb.c'
fi
if test -f 'flpic.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'flpic.c'\"
else
echo shar: Extracting \"'flpic.c'\" \(1082 characters\)
sed "s/^X//" >'flpic.c' <<'END_OF_FILE'
X
X#include <stdio.h>
X#include "fbm.h"
X/*
X * read_pic(image, rfile, mstr, mlen)
X *
X */
X
Xread_pic(image, rfile, mstr, mlen)
XFBM *image;
XFILE *rfile;
Xchar *mstr;
Xint mlen;
X{
Xunsigned int		Width, Height;
Xint			i,j;
Xunsigned char		*Red, *Grn, *Blu;
X
Xfscanf(rfile,"%d %d\n",&Height,&Width);
X
X/* Create output image header */
X	image->hdr.rows = Height;
X	image->hdr.cols = Width;
X	/* If this is odd number of bytes, add one */
X	if ((image->hdr.cols & 1) != 0) image->hdr.cols++;
X	image->hdr.planes = 3;
X	image->hdr.bits = 8;
X	image->hdr.physbits = 8;
X	image->hdr.rowlen = image->hdr.cols;
X	image->hdr.plnlen = image->hdr.rows * image->hdr.cols;
X	image->hdr.clrlen = 0;
X	image->hdr.aspect = 1.0;
X	image->hdr.title[0] = '\0';
X	image->hdr.credits[0] = '\0';
X
X/* Get the Image */
X	alloc_fbm(image);
X
X	Red = image->bm;
X	Grn = Red + image->hdr.plnlen;
X	Blu = Grn + image->hdr.plnlen;
X	for (i=0; i< Height; i++)
X	{
X		for (j=0; j< Width; j++)
X		{
X			fread(Red++,1,1,rfile);
X			fread(Grn++,1,1,rfile);
X			fread(Blu++,1,1,rfile);
X		}
X		if (Width != image->hdr.cols)
X		{
X			Red++;Grn++;Blu++;
X		}
X	}
X}
END_OF_FILE
if test 1082 -ne `wc -c <'flpic.c'`; then
    echo shar: \"'flpic.c'\" unpacked with wrong size!
fi
# end of 'flpic.c'
fi
if test -f 'gray2clr.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'gray2clr.1'\"
else
echo shar: Extracting \"'gray2clr.1'\" \(1559 characters\)
sed "s/^X//" >'gray2clr.1' <<'END_OF_FILE'
X.TH GRAY2CLR 1 07-Apr-89
X.CM 3
X.SH NAME
Xgray2clr, unmap \- add a colormap to a grayscale image, unmap a color image
X.SH SYNOPSIS
X.nf
Xgray2clr [ -<type> ] [ -u ] < gray > color	or
X.br
Xunmap [ -<type> ] < gray > color
X.fi
X.SH DESCRIPTION
X.PP
XAdds a colormap to an 8bit grayscale image, allowing it to be displayed
Xon a frame buffer.  The image will still be black and white, of course.
X.sp
XIf invoked as
X.I unmap,
Xor with the
X.B -u
Xoption, the output is given as RGB values instead of mapped color.
XThis routine can be used to convert mapped color to unmapped color as
Xwell.  This must be done before
X.I fbext
Xis used to resize a mapped color image.  Then the result can be
Xremapped using
X.I fbquant.
X.SH OPTIONS
X.TP
X.BR -u
X.I unmap,
Xmakes the output a 3 plane image, instead of a mapped imsage.
XThis must be done before the image can be resized (with fbext(1)) or
Xquantized (with fbquant(1)).
X.SH EXAMPLE
XAdd a colormap to a grayscale file for viewing on a frame buffer:
X.sp
X    % gray2clr -S < foo.8bit > foo.clr
X.sp
XConvert a mapped color image to unmapped and then adjust the aspect
Xratio:
X.sp
X    % gray2clr -u < foo.gif | fbext -a1 > foo.fbm
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Apr-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.91) mlm@cs.cmu.edu
END_OF_FILE
if test 1559 -ne `wc -c <'gray2clr.1'`; then
    echo shar: \"'gray2clr.1'\" unpacked with wrong size!
fi
# end of 'gray2clr.1'
fi
if test -f 'idiff.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'idiff.1'\"
else
echo shar: Extracting \"'idiff.1'\" \(1082 characters\)
sed "s/^X//" >'idiff.1' <<'END_OF_FILE'
X.TH IDIFF 1 07-Mar-89
X.CM 3
X.SH NAME
Xidiff, udiff \- convert byte stream to difference stream (b[n]-[bn-1])
X.SH SYNOPSIS
X.nf
Xidiff < original > delta
Xudiff < delta > original
X.fi
X.SH DESCRIPTION
X.PP
XUsed as a preprocessor for compression algorithms.  Some images
X(especially grayscale and RGB) compress better when the compression is
Xperformed on the difference between adjacent bytes, rather than the
Xbytes themselves (savings up to 30% are common).
X.sp
XUse
X.I idiff
Xto convert the original to a delta file, and
X.I udiff
Xto restore.
X.sp
XThere are no magic numbers or headers, so there is no good way to tell
Xwhether a file has been "idiffed" by examining the contents.
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1082 -ne `wc -c <'idiff.1'`; then
    echo shar: \"'idiff.1'\" unpacked with wrong size!
fi
# end of 'idiff.1'
fi
if test -f 'idiff.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'idiff.c'\"
else
echo shar: Extracting \"'idiff.c'\" \(1342 characters\)
sed "s/^X//" >'idiff.c' <<'END_OF_FILE'
X/*****************************************************************
X * idiff.c: FBM Library 0.9 (Beta test) 07-Mar-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * idiff.c: 
X *
X * USAGE
X *	% idiff [ flags ] arguments
X *
X * EDITLOG
X *	LastEditDate = Tue Mar  7 17:23:58 1989 - Michael Mauldin
X *	LastFileName = /usr2/mlm/src/misc/fbm/idiff.c
X *
X * HISTORY
X * 07-Mar-89  Michael Mauldin (mlm) at Carnegie Mellon University
X *	Beta release (version 0.9) mlm@cs.cmu.edu
X *
X * 18-Aug-88  Michael Mauldin (mlm) at Carnegie-Mellon University
X *	Created.
X *****************************************************************/
X
X# include <stdio.h>
X
X# define USAGE \
X"Usage: idiff < original > delta\n       udiff < delta > original"
X
X#ifndef lint
Xstatic char *fbmid =
X	"$FBM idiff.c <0.9> 07-Mar-89  (C) 1989 by Michael Mauldin$";
X#endif
X
Xmain (argc, argv)
Xchar *argv[];
X{ register int ch, lastch=0;
X
X  if (argc > 1 || !strcmp (argv[0] + strlen (argv[0]) - 5, "udiff"))
X  { while ((ch = getchar ()) != EOF)
X    { putchar (lastch = ((ch+lastch) & 255)); }
X  }
X  else
X  { while ((ch = getchar ()) != EOF)
X    { putchar ((ch-lastch) & 255);
X      lastch = ch;
X    }
X  }
X}
END_OF_FILE
if test 1342 -ne `wc -c <'idiff.c'`; then
    echo shar: \"'idiff.c'\" unpacked with wrong size!
fi
# end of 'idiff.c'
fi
if test -f 'pbm2ps.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pbm2ps.1'\"
else
echo shar: Extracting \"'pbm2ps.1'\" \(1740 characters\)
sed "s/^X//" >'pbm2ps.1' <<'END_OF_FILE'
X.TH PBM2PS 1 07-Mar-89
X.CM 3
X.SH NAME
Xpbm2ps \- convert a PBM file to postscript (option for Scribe files)
X.SH SYNOPSIS
X.nf
Xpbm2ps [ -s ] [ scale ] < pbm > postscript
X.fi
X.SH DESCRIPTION
X.PP
XThis is an enhanced version of Poskanzer's
X.I pbmtops
Xcommand that includes an option to generate "bare" files for including
Xin documents (the
X.B -s
Xor scribe option).  It also prints the title at the top, if there is
Xone attached to the image.
X.sp
XThe
X.I scale
Xif given must be an integer number which indicates how many output dots
X(at 300 dpi) are used to render a single pixel.  The default is 1.
X.SH EXAMPLE
X.PP
XGiven a 480 by 600 pixel bitmap, create a postscript file with the
Xlargest integral scaling factor that fits on a regular page:
X.sp
X    % pbm2ps < foo.1bit > foo.PS
X.sp
XGiven the same bitmap, create a postscript file
Xwith each input pixel represented by a 2x2
Xblock of 300 dpi pixels on the output page (scaling factor 2):
X.sp
X    % pbm2ps 2 < foo.1bit > foo.PS
X.sp
XNote that the resulting image will be 3.2 inches wide and 4 inches tall
X(pixels * scale / 300 dpi).
X.sp
XCreate the same image, but don't include document structuring commands
X(this allows the file to be included in other documents by formatters
Xsuch as Scribe and TeX).
X.sp
X    % pbm2ps -s 2 < foo.1bit > foo.PS
X.SH SEE ALSO
Xfbm2ps(1) for converting grayscale files.
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1740 -ne `wc -c <'pbm2ps.1'`; then
    echo shar: \"'pbm2ps.1'\" unpacked with wrong size!
fi
# end of 'pbm2ps.1'
fi
if test -f 'pbmtitle.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pbmtitle.1'\"
else
echo shar: Extracting \"'pbmtitle.1'\" \(703 characters\)
sed "s/^X//" >'pbmtitle.1' <<'END_OF_FILE'
X.TH PBMTITLE 1 07-Mar-89
X.CM 3
X.SH NAME
Xpbmtitle \- add a title to PBM files (titles used in FBM files)
X.SH SYNOPSIS
X.nf
Xpbmtitle 'new title' < pbm > pbm
X.fi
X.SH DESCRIPTION
X.PP
XAdds or replaces the title of a pbm file.
X.SH EXAMPLE
X.PP
X.nf
X    pbmtitle -t'New title' < foo.pbm > bar.pbm
X.fi
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 703 -ne `wc -c <'pbmtitle.1'`; then
    echo shar: \"'pbmtitle.1'\" unpacked with wrong size!
fi
# end of 'pbmtitle.1'
fi
if test -f 'pbmtitle.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pbmtitle.c'\"
else
echo shar: Extracting \"'pbmtitle.c'\" \(1429 characters\)
sed "s/^X//" >'pbmtitle.c' <<'END_OF_FILE'
X/*****************************************************************
X * pbmtitle.c: FBM Library 0.9 (Beta test) 07-Mar-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * pbmtitle.c: Add a title to a pbm bitmap
X *
X * USAGE
X *	% pbmtitle [ flags ] arguments
X *
X * EDITLOG
X *	LastEditDate = Tue Mar  7 19:57:46 1989 - Michael Mauldin
X *	LastFileName = /usr2/mlm/src/misc/fbm/pbmtitle.c
X *
X * HISTORY
X * 07-Mar-89  Michael Mauldin (mlm) at Carnegie Mellon University
X *	Beta release (version 0.9) mlm@cs.cmu.edu
X *
X * 23-Sep-88  Michael Mauldin (mlm) at Carnegie-Mellon University
X *	Created.
X *****************************************************************/
X
X# include <stdio.h>
X
X# define USAGE "Usage: pbmtitle 'new title' < pbm > pbm"
X
X#ifndef lint
Xstatic char *fbmid =
X	"$FBM pbmtitle.c <0.9> 07-Mar-89  (C) 1989 by Michael Mauldin$";
X#endif
X
Xmain (argc, argv)
Xchar *argv[];
X{ char buf[BUFSIZ];
X  int lines=0;
X
X  if (argc != 2 || argv[1][0] == '-')
X  { fprintf (stderr, "%s\n", USAGE);
X    exit (1);
X  }
X  
X  while (fgets (buf, BUFSIZ, stdin))
X  { if (buf[0] != '#') { printf ("%s", buf); lines++; }
X    else if (strncmp (buf, "# Title: ", 9)) printf ("%s", buf);
X    
X    if (lines == 2) printf ("# Title: %s\n", argv[1]);
X  }
X  
X  exit (0);
X}
END_OF_FILE
if test 1429 -ne `wc -c <'pbmtitle.c'`; then
    echo shar: \"'pbmtitle.c'\" unpacked with wrong size!
fi
# end of 'pbmtitle.c'
fi
if test -f 'pic2fbm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pic2fbm.c'\"
else
echo shar: Extracting \"'pic2fbm.c'\" \(1377 characters\)
sed "s/^X//" >'pic2fbm.c' <<'END_OF_FILE'
X/*****************************************************************
X * pic2fbm.c: FBM Library 0.93 (Beta test) 03-May-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * pic2fbm.c: convert a bitmap to Targa format
X *
X * USAGE
X *	% pic2fbm [ image.pic ] > image.fbm
X *
X * EDITLOG
X *	LastEditDate = Wed May  3 21:50:43 1989 - Michael Mauldin
X *	LastFileName = /usr2/mlm/src/misc/fbm/pic2fbm.c
X *
X * HISTORY
X * 03-May-89  Michael Mauldin (mlm) at Carnegie Mellon University
X *	Beta release (version 0.93) mlm@cs.cmu.edu
X *****************************************************************/
X
X# include <stdio.h>
X# include <math.h>
X# include "fbm.h"
X
X# define USAGE\
X"Usage: pic2fbm [ image.pic ] > image.fbm"
X
X#ifndef lint
Xstatic char *fbmid =
X	"$FBM pic2fbm.c <0.93> 03-May-89  (C) 1989 by Michael Mauldin$";
X#endif
Xmain(argc,argv)
Xint argc; char *argv[];
X{ FBM image;
X
X  /* Clear pointers */
X  image.cm = image.bm = (unsigned char *) NULL;
X
X  /* Open input if given */
X  if (argc > 1)
X  { if (freopen (argv[1], "r", stdin) != stdin)
X    { perror (argv[1]);
X      exit(1);
X    }
X  }
X
X  if (read_pic (&image, stdin, "", 0) &&
X       write_fbm (&image, stdout))
X  { exit(0); }
X  else
X  { exit (1); }
X}
END_OF_FILE
if test 1377 -ne `wc -c <'pic2fbm.c'`; then
    echo shar: \"'pic2fbm.c'\" unpacked with wrong size!
fi
# end of 'pic2fbm.c'
fi
if test -f 'qrt2fbm.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'qrt2fbm.1'\"
else
echo shar: Extracting \"'qrt2fbm.1'\" \(1095 characters\)
sed "s/^X//" >'qrt2fbm.1' <<'END_OF_FILE'
X.TH QRT2FBM 1 07-Mar-89
X.CM 3
X.SH NAME
Xqrt2fbm \- convert QRT image files to FBM format (Output from the QRT ray tracer)
X.SH SYNOPSIS
X.nf
Xqrt2fbm [ -t'title' -c'credits' ] < rawfile > fbm
X.fi
X.SH DESCRIPTION
X.PP
XConverts a file in the format ouput by the QRT ray tracing package to
Xfbm format.
X.SH OPTIONS
X.TP
X.BR -t'title'
X.I title,
Xspecify a character string (up to 80 characters) to describe the image.
XThe default is no title.
X.TP
X.BR -c'credits'
X.I credits or subtitle,
Xspecify a second character string (up to 80 characters) to describe the
Ximage.  The default is no credit string.
X.SH EXAMPLE
X.PP
X    qrt2fbm -t'Tiger' -c'Joe' < tiger.raw > tiger.fbm
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XModified by Butler Hine.
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1095 -ne `wc -c <'qrt2fbm.1'`; then
    echo shar: \"'qrt2fbm.1'\" unpacked with wrong size!
fi
# end of 'qrt2fbm.1'
fi
if test -f 'raw2fbm.1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'raw2fbm.1'\"
else
echo shar: Extracting \"'raw2fbm.1'\" \(1901 characters\)
sed "s/^X//" >'raw2fbm.1' <<'END_OF_FILE'
X.TH RAW2FBM 1 07-Mar-89
X.CM 3
X.SH NAME
Xraw2fbm \- convert raw image files to FBM format (especially Digi-View files)
X.SH SYNOPSIS
X.nf
Xraw2fbm [ -t'title' -c'credits' -a<aspect>
X          -w<width> -h<height> -d'<planes> ] < rawfile > fbm
X.fi
X.SH DESCRIPTION
X.PP
XConverts a raw image (stored in row major order, or red/green/blue for
Xcolor images) to fbm format.  The defaults are width=640, height=400,
Xdepth=1, and aspect ratio=1.2 (the correct settings for output
Xfrom the Amiga Digi-View package).
X.SH OPTIONS
X.TP
X.BR -d
X.I depth,
Xnumber of byte planes in image.  Default is 1.  Use -d3 for RGB color
Ximages.
X.TP
X.BR -w
X.I width,
Xnumber of pixels per row, assumes 1 byte per pixel.  The default is 640.
X.TP
X.BR -h
X.I height,
Xnumber of rows in image.  The default is 400.
X.TP
X.BR -a
X.I aspect ratio,
Xthe ratio of the height to width of a single pixel.  The default is 1.2
X(for Digi-View files).
X.TP
X.BR -t'title'
X.I title,
Xspecify a character string (up to 80 characters) to describe the image.
XThe default is no title.
X.TP
X.BR -c'credits'
X.I credits or subtitle,
Xspecify a second character string (up to 80 characters) to describe the
Ximage.  The default is no credit string.
X.SH EXAMPLE
X.PP
XAssume a Digi-View "raw" color image of a tiger, 640x400 pixels with
X1.2 to 1 aspect ratio (EL Arts calls is 1.1):
X.sp
X    % raw2fbm -a1.2 -w640 -h400 -d3 \
X.br
X      -t'Tiger' -c'Joe' < tiger.raw > tiger.fbm
X.sp
Xor in this case:
X.sp
X    % raw2fbm -d3 -t'Tiger' -c'Joe' < tiger.raw > tiger.fbm
X.SH SEE ALSO
Xfbm(1) for general discussion, pbm(1) for PBM routines.
X.SH BUGS
XNone known.
X.SH HISTORY
XCopyright (c) 1989 by Michael L. Mauldin.  
XPermission is granted to use this program in whole or in part provided
Xthat you do not sell it for profit and that this copyright notice is
Xretained unchanged.
X.TP
X07-Mar-89  Michael L. Mauldin at Carnegie Mellon University
XBeta release (version 0.9) mlm@cs.cmu.edu
END_OF_FILE
if test 1901 -ne `wc -c <'raw2fbm.1'`; then
    echo shar: \"'raw2fbm.1'\" unpacked with wrong size!
fi
# end of 'raw2fbm.1'
fi
if test -f 'tga2fbm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tga2fbm.c'\"
else
echo shar: Extracting \"'tga2fbm.c'\" \(1373 characters\)
sed "s/^X//" >'tga2fbm.c' <<'END_OF_FILE'
X/*****************************************************************
X * tga2fbm.c: FBM Library 0.93 (Beta test) 03-May-89  Michael Mauldin
X *
X * Copyright (C) 1989 by Michael Mauldin.  Permission is granted to
X * use this file in whole or in part provided that you do not sell it
X * for profit and that this copyright notice is retained unchanged.
X *
X * tga2fbm.c: convert a bitmap to Targa format
X *
X * USAGE
X *	% tga2fbm [ image ] > image.tga
X *
X * EDITLOG
X *	LastEditDate = Wed May  3 21:50:43 1989 - Michael Mauldin
X *	LastFileName = /usr2/mlm/src/misc/fbm/tga2fbm.c
X *
X * HISTORY
X * 03-May-89  Michael Mauldin (mlm) at Carnegie Mellon University
X *	Beta release (version 0.93) mlm@cs.cmu.edu
X *****************************************************************/
X
X# include <stdio.h>
X# include <math.h>
X# include "fbm.h"
X
X# define USAGE\
X"Usage: tga2fbm [ image ] > image.tga"
X
X#ifndef lint
Xstatic char *fbmid =
X	"$FBM tga2fbm.c <0.93> 03-May-89  (C) 1989 by Michael Mauldin$";
X#endif
X
Xmain (argc, argv)
Xint argc;
Xchar *argv[];
X{ FBM image;
X
X  /* Clear pointers */
X  image.cm = image.bm = (unsigned char *) NULL;
X
X  /* Open input if given */
X  if (argc > 1)
X  { if (freopen (argv[1], "r", stdin) != stdin)
X    { perror (argv[1]);
X      exit(1);
X    }
X  }
X
X  if (read_tga (&image, stdin, "", 0) &&
X       write_fbm (&image, stdout))
X  { exit(0); }
X  else
X  { exit (1); }
X}
X
END_OF_FILE
if test 1373 -ne `wc -c <'tga2fbm.c'`; then
    echo shar: \"'tga2fbm.c'\" unpacked with wrong size!
fi
# end of 'tga2fbm.c'
fi
echo shar: End of archive 1 \(of 8\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 8 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.