Dec 072017
Latest version of the Fuzzy Pixmap Manipulation (FBM) library of programs. Full C source included.
File FBM10.ZIP from The Programmer’s Corner in
Category C Source Code
Latest version of the Fuzzy Pixmap Manipulation (FBM) library of programs. Full C source included.
File Name File Size Zip Size Zip Type
CLR2GRAY.1 2129 1072 deflated
CLR2GRAY.C 3012 1227 deflated
FBCAT.1 2526 1218 deflated
FBCAT.C 3679 1493 deflated
FBCLEAN.1 2215 1130 deflated
FBCLEAN.C 3687 1524 deflated
FBEDGE.1 1830 982 deflated
FBEDGE.C 3458 1451 deflated
FBEXT.1 3066 1450 deflated
FBEXT.C 6873 2402 deflated
FBGAMMA.C 4176 1640 deflated
FBHALF.1 3917 1837 deflated
FBHALF.C 6738 2444 deflated
FBHAM.1 1768 962 deflated
FBHAM.C 15917 5392 deflated
FBHIST.1 1813 982 deflated
FBHIST.C 3122 1369 deflated
FBINFO.1 1202 678 deflated
FBINFO.C 3076 1279 deflated
FBM.1 7103 3114 deflated
FBM.H 4338 1642 deflated
FBM2POD.1 1363 779 deflated
FBM2POD.C 6045 2393 deflated
FBM2TGA.C 1690 835 deflated
FBM2TIFF.C 8386 2936 deflated
FBMASK.1 1324 723 deflated
FBMASK.C 3248 1379 deflated
FBNORM.1 2010 976 deflated
FBNORM.C 5668 2066 deflated
FBPALET.C 5771 2090 deflated
FBPS.1 1914 987 deflated
FBPS.C 8674 3018 deflated
FBQUANT.1 3033 1450 deflated
FBQUANT.C 29874 8337 deflated
FBREV.C 3624 1384 deflated
FBROT.1 1575 836 deflated
FBROT.C 2903 1213 deflated
FBSAMPLE.1 2885 1401 deflated
FBSAMPLE.C 4739 1837 deflated
FBSHARP.1 2071 1091 deflated
FBSHARP.C 3331 1398 deflated
FEATURES 5113 2191 deflated
FLALFB.C 2446 949 deflated
FLBLUE.C 6380 2166 deflated
FLBYTE.C 4559 1166 deflated
FLCAVG.C 3551 1432 deflated
FLCLR.C 8341 2352 deflated
FLEDGE.C 9052 2126 deflated
FLEXTR.C 6556 2246 deflated
FLFACE.C 4098 1480 deflated
FLFLYD.C 4807 1777 deflated
FLGIFC.C 13113 4277 deflated
FLGIFE.C 6147 2245 deflated
FLGIFR.C 15196 4220 deflated
FLGIFW.C 4083 1734 deflated
FLIFF.C 24558 7284 deflated
FLKLNR.C 7303 2369 deflated
FLPBM.C 5477 1861 deflated
FLPCX.C 14183 4149 deflated
FLPIC.C 2323 1038 deflated
FLRDFB.C 5106 1496 deflated
FLREAD.C 5040 1713 deflated
FLRLE.C 3195 1252 deflated
FLROT.C 5711 1407 deflated
FLSHRP.C 5749 1652 deflated
FLSUN.C 9612 2799 deflated
FLTGA.C 18929 4355 deflated
FLTHRE.C 2696 1146 deflated
FLUUN.C 2727 1233 deflated
FLWRFB.C 3303 1120 deflated
FTP 628 369 deflated
GLOSSARY 612 323 deflated
GRAY2CLR.1 1816 907 deflated
GRAY2CLR.C 2818 1184 deflated
IDIFF.1 1321 748 deflated
IDIFF.C 1679 799 deflated
MAKEFILE 17122 3882 deflated
MPS2FBM.C 4041 1695 deflated
PBM2PS.1 1999 1034 deflated
PBM2PS.C 7810 2835 deflated
PBMTITLE.1 934 541 deflated
PBMTITLE.C 1769 858 deflated
PIC2FBM.C 1718 837 deflated
QRT2FBM.1 1311 690 deflated
QRT2FBM.C 2961 1311 deflated
RAW2FBM.1 2172 1049 deflated
RAW2FBM.C 3957 1607 deflated
README 8198 3382 deflated
TESTCLRZ.UU 68861 51053 deflated
TGA2FBM.C 1715 834 deflated
TIFF2FBM.1 1501 831 deflated
TIFF2FBM.C 9115 3255 deflated
UUNET2FB.1 513 308 deflated
UUNET2FB.C 1107 557 deflated

Download File FBM10.ZIP Here

Contents of the README file

This directory contains Release 1.0 of the Fuzzy Pixmap Manipulation (FBM)
library of programs. This collection (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.


Unpack all files in one directory. Edit Makefile and put in
appropriate values for defaults.

If you wish to have the tiff2fbm and fbm2tiff programs, first
obtain, unpack, and compile libtiff.a, and then modify FBM 's
Makefile to include this library. Then type "make tiff". Note
that some versions of libtiff are not careful to put file
tiffcompat.h into the intstall directory. The tifflib is
available from UCBVAX.BERKELEY.EDU, file pub/tiff/v2.2.tar.Z.

If you have the Utah Raster Toolkit, the 'fbcat' program can be
compiled with the -DRLE flag to include support for RLE files.
Credit for RLE support to Paul Milazzo .
Get the Toolkit from CS.UTAH.EDU, file pub/toolkit-2.0.tar.Z.

Get Jef Poskanzer's PBMPLUS source from EXPO.LCS.MIT.EDU, file

File Formats

FBM (-F)FBM file with 256 byte header (with title & credits)
Sun (-S)Sun rasterfile with 32 byte header
Tiff (-T)Aldus TIFF
PBM (-P)Poskanzer format for 1bit files
GIF (-G)CompuServe GIF format
RLE (-R)Utah RLE format
IFF (-I)Amiga IFF files (except HAM mode files)
PCX (-Z)PC PaintBrush format for IBM
Face (-B)Bennet Yee's 1bit files, used at CMU

All programs (except fbinfo) can read any of the formats, and use
the magic number to decide the file type. If the input is not a
pipe and is compressed using the net standard 'compress' program,
the file will be uncompressed as it is read. Note however that
the operation to be performed must make sense; that is you cannot
halftone a color image, quantize a grayscale image, or resize a
1bit file.

Files and Programs:

READMEThis file
README.libLists the subroutines in libfbm.a
MakefileMake utility configuration file
fbm.1General manual entry
*.1Individual manual entries
fbm.hDefines FBM data structures

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
fbgamma Gamma correct grayscale or color image for display
fbhalf Halftone grayscale image (Blue noise, Floyd-Steinberg, etc)
fbham Convert FBM 24bit RGB to Amiga HAM mode
fbhist Compute histogram
fbinfo Dump image header
fbm2pod Convert grayscale image to Diablo graphics (!)
fbm2tga Convert image to Targa format
fbm2tiff Convert FBM files to 1, 2, 4, 8, or 24 bit TIFF
fbmask Set region to gray value
fbnorm Normalize image intensity / increase contrast
fbpalet Replace an imager's colormap with another, remove duplicates
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)
tga2fbm Convert Targa file to FBM format
tiff2fbm Convert tiff file to FBM format
uunet2fbm Convert UseNet Facesaver file to FBM format


Several file extension conventions are used, but none are enforced

.ZCompressed file, appended to other extensions

.fbmStandard extension for FBM format files
.cbmSometimes used to mean a 24bit color FBM file

.ip8bit grayscale Amiga file (with 1.2 aspect ratio)
.cp24bit color Amiga file (with 1.2 aspect ratio)

.1bitSun 1bit rastefile
.clrSometimes used to mean a 8bit mapped color Sun file

.bmBennet Yee's "Face" format (1bit)
.pbmPoskanzer 1bit format
.gifCompuserve GIF format
.pcxZSoft's PCPaintbrush format
.tif or .tiffAldus's TIFF format (used on NeXT)

Example Unix pipelines to view files:

Starting with an 8 bit raw Amiga grayscale file, foo.ip, first
create an FBM format file with a title and credit, then process
that file for viewing on a Sun screen by normalizing, rotating,
resizing, sharpening, and halftoning.

% raw2fbm -d1 -a1.2 -w640 -h400 \
-t'Random Title' -c'Random Credit' < foo.ip > foo.fbm

% fbinfo foo.fbm
foo.fbm "Random Title"
[ Random Credit ]
[640x400x8] 8 physbits 1.2 aspect ratio
row length 640, plane length 256000, colormap length 0

% fbnorm < foo.fbm | \(normalize)
fbrot | \(rotate 90 deg clockwise)
fbext -a1 -W900 -H768 | \(resize & make aspect ratio 1)
fbhalf -s10 -S > foo.1bit(sharpen, halftone, write Sun)

Starting with a 24 bit color Amiga file, bar.cp, first create an
FBM format file with title and credit, then render that file for
viewing on a Sun by normalizing, rotating, sharpening, and

% raw2fbm -d3 -a1.2 -w640 -h400 \
-t'Random Color Title' -c'Random Color Credit' < bar.cp > bar.cbm

% fbinfo bar.cbm
bar.cbm "Random Color Title"
[ Random Color Credit ]
[3x640x400x8] 8 physbits 1.2 aspect ratio
row length 640, plane length 256000, colormap length 0

% fbnorm < bar.cbm | \(normalize)
fbrot | \(rotate 90 deg clockwise)
fbext -a1 -W900 -H768 | \(resize & make aspect ratio 1)
fbsharp 3.0 | \(sharpen it)
fbquant -S > bar.clr(quantize and write Sun)

(Note that sharpening is an integral option to the halftoning
program using the -s option, but that color images must currently
be sharpened using a separate program. Note also that more
sharpening is used on black and white images than on color images).

Starting with a 256 color Sun raster image, baz.clr, generate a NeXT
readable 2bit grayscale image (note fbm2tiff is not a filter, but
writes to a named file. Tiff2fbm reads a named file):

-- Without Dithering --
% clr2gray < baz.clr | \(convert to gray)
fbm2tiff -N baz.tiff(chop 8bit grays to 2bit)

-- With Dithering (note 1) --
% clr2gray < baz.clr | \(convert to gray)
fbnorm | \(normalize, optional)
unmap | \(convert to RGB)
fbquant -c4 | \(fbquant also dithers RGB)
clr2gray | \(back to gray: 0, 85, 190, 255)
fbm2tiff -N baz.tiff(convert 4 grays to NeXT 2bit)

Note 1: Yes, this is gross...and inefficient. But the
images look fine. Dithering should be an option of fbm2tiff,
and really the halftoning algorithms should be generalizes
to produce more than just bitmaps.

Notes on the 'fbext' program

Usage:fbext [ -w -h -W -H
-s -a -t'title' -c'credits' ]
[ x y [ width height ] ]
< foo.fbm > bar.fbm

fbext (bitmap extract) is a very useful anmd multipurpose program.
Its basic operation is to copy a rectangular portion of one image
(color or black and white) to a second image, possibly changing
either the width or height or both. It can also change the title
or credits fields of the image. Because it is so versatile, there
are a host of options:

-w or -hForce width and/or height to a certain size
-W or -HLimit width and height to a certain size
-aForce the output to have a given aspect ratio
-sScale image to have no more than a given
number of pixels.
select a rectangular region of the image
to extract. The default is the entire image.

Note that the output size limits are cumulative. Thus if you set a
maximum width, height, and number of pixels, the image will be the
smallest of the three limits.

 December 7, 2017  Add comments

Leave a Reply