-->
Page 353
DESCRIPTION
pbmlife reads a portable bitmap as input, applies the Rules of Life to it for one generation, and produces a portable bitmap as output.
A white pixel in the image is interpreted as a live beastie, and a black pixel as an empty space.
SEE ALSO
pbm(5)
AUTHOR
Copyright " 1988, 1991 by Jef Poskanzer
21 February 1991
pbmmakeCreate a blank bitmap of a specified size
SYNOPSIS
pbmmake [-white|-black|-gray ] width height
DESCRIPTION
pbmmake produces a portable bitmap of the specified width and height. The color defaults to white.
OPTIONS
In addition to the usual -white and -black, this program implements -gray. This gives a simple 50 percent gray pattern with 1's and 0's alternating.
All flags can be abbreviated to their shortest unique prefix.
SEE ALSO
pbm(5), ppmmake(1)
AUTHOR
Copyright " 1989 by Jef Poskanzer
22 February 1989
pbmmaskCreate a mask bitmap from a regular bitmap
SYNOPSIS
pbmmask [-expand][pbmfile]
DESCRIPTION
pbmmask reads a portable bitmap as input and creates a corresponding mask bitmap and writes it out.
The color to be interpreted as background is determined automatically. Regardless of which color is background, the mask will be white where the background is white and black where the figure is black.
Page 354
This lets you do a masked paste like this, for objects with a black background:
pbmmask obj > objmask pnmpaste < dest -and objmask <x><y>|pnmpaste -or obj <x><y>
For objects with a white background, you can either invert them or add a step:
pbmmask obj > objmask pnminvert objmask | pnmpaste -and obj 0 0 > blackback pnmpaste < dest -and objmask <x><y>|pnmpaste -or blackback <x><y>
Note that this three-step version works for objects with black backgrounds, too, if you don't care about the wasted time.
You can also use masks with graymaps and pixmaps, using the pnmarith tool. For instance:
ppmtopgm obj.ppm | pgmtopbm -threshold | pbmmask > objmask.pbm pnmarith -multiply dest.ppm objmask.pbm > t1.ppm pnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm pnmarith -add t1.ppm t2.ppm
An interesting variation on this is to pipe the mask through the pnmsmooth script before using it. This makes the boundary between the two images less sharp.
OPTIONS
-expand Expands the mask by one pixel out from the image. This is useful if you want a little white border around your image. (A better solution might be to turn the pbmlife tool into a general cellular automaton tool )
SEE ALSO
pnmpaste(1), pnminvert(1), pbm(5), pnmarith(1), pnmsmooth(1)
AUTHOR
Copyright " 1988 by Jef Poskanzer
8 August 1989
pbmpscaleEnlarge a portable bitmap with edge smoothing
SYNOPSIS
pbmpscale N [ pbmfile ]
DESCRIPTION
pbmpscale reads a portable bitmap as input and outputs a portable bitmap enlarged N times. Enlargement is done by pixel replication, with some additional smoothing of corners and edges.
SEE ALSO
pnmenlarge(1), ppmscale(1), pbm(5)
AUTHOR
Copyright " 1990 by Angus Duggan. Copyright " 1989 by Jef Poskanzer.
NOTES
pbmpscale works best for enlargements of 2. Enlargements greater than 2 should be done by as many enlargements of 2 as possible, followed by an enlargement by the remaining factor.
Page 355
pbmreduceRead a portable bitmap and reduce it N times
SYNOPSIS
pbmreduce [-floyd|-fs|-threshold ][-value val] N [pbmfile]
DESCRIPTION
pbmreduce reads a portable bitmap as input, reduces it by a factor of N, and produces a portable bitmap as output.
pbmreduce duplicates a lot of the functionality of pgmtopbm; you could do something like pnmscale | pgmtopbm, but pbmreduce is a lot faster.
pbmreduce can be used to "re-halftone" an image. Say you have a scanner that only produces black and white, not grayscale, and it does a terrible job of halftoning (most black-and-white scanners fit this description). One way to fix the halftoning is to scan at the highest possible resolution, say 300dpi, and then reduce by a factor of three or so using pbmreduce.You can even correct the brightness of an image, by using the -value flag.
OPTIONS
By default, the halftoning after the reduction is done via boustrophedonic Floyd-Steinberg error diffusion; however, the -threshold flag can be used to specify simple thresholding. This gives better results when reducing line drawings.
The -value flag alters the thresholding value for all quantizations. It should be a real number between 0 and 1. Above 0.5 means darker images; below 0.5 means lighter.
All flags can be abbreviated to their shortest unique prefix.
SEE ALSO
pnmenlarge(1), pnmscale(1), pgmtopbm(1), pbm(5)
AUTHOR
Copyright " 1988 by Jef Poskanzer
2 August 1989
pbmtextRender text into a bitmap
SYNOPSIS
pbmtext [_font fontfile][_builtin fontname][text]
DESCRIPTION
pbmtext takes the specified text, either a single line from the command line or multiple lines from standard input, and renders it into a bitmap.
OPTIONS
By default, pbmtext uses a built-in font called bdf (about a 10-point Times Roman font). You can use a fixed-width font by specifying _builtin fixed.
You can also specify your own font with the -font flag. The fontfile is either a BDF file from the X Window System or a PBM file.