.TL Pamditherbw User Manual .SH 1 pamditherbw .LP Updated: 20 June 2004 .br Table Of Contents .SH 2 NAME .LP pamditherbw - dither grayscale image to black and white .SH 2 SYNOPSIS .LP \fBpamditherbw\fR [\fB-floyd\fR | \fB-fs\fR | \fB-threshold\fR | \fB-hilbert\fR | \fB-dither8\fR | \fB-d8\fR | \fB-cluster3\fR | \fB-c3\fR | \fB-cluster4\fR | \fB-c4\fR | \fB-cluster8\fR | \fB-c8\fR] [\fB-value\fR \fIval\fR] [\fB-clump\fR \fIsize\fR] [\fIpamfile\fR] .SH 2 DESCRIPTION .LP .LP This program is part of Netpbm. .LP \fBpamditherbw\fR dithers a grayscale image. Dithering means turning each shade of gray into a pattern of black and white pixels that, from a distance, look the same as the gray. .LP The input should be a PGM image or a PAM image of tuple type GRAYSCALE. However, \fBpamditherbw\fR doesn't check, so if you feed it e.g. a PPM image, it will produce arbitrary results (actually, it just takes the first channel of whatever you give it and treats it as if it represented gray levels). .LP The output is a PAM with tuple type BLACKANDWHITE. You can turn this into a PBM (if you need to use it with an older program doesn't understand PAM) with \fBpamtopnm\fR. .LP To do the opposite of dithering, you can usually just scale the image down and then back up again with \fBpamscale\fR, possibly smoothing or blurring the result with \fBpnmsmooth\fR or \fBpnmconvol\fR. Or use the special case program \fBpbmtopgm\fR. .LP To dither a color image (to reduce the number of pixel colors), use \fBppmdither\fR. .LP Another way to convert a grayscale image to a black and white image is thresholding. Thresholding is simply replacing each grayscale pixel with a black or white pixel depending on wether its brightness is above or below a threshold. That threshold might vary. Simple thresholding is a degenerate case of dithering, so \fBpamditherbw\fR does very simple thresholding with its \fB-threshold\fR option. But \fBpamthreshold\fR does more sophisticated thresholding. .SH 2 OPTIONS .LP .LP The default quantization method is boustrophedonic Floyd-Steinberg error diffusion (\fB-floyd\fR or \fB-fs\fR). .LP Also available are simple thresholding (\fB-threshold\fR); Bayer's ordered dither (\fB-dither8\fR) with a 16x16 matrix; and three different sizes of 45-degree clustered-dot dither (\fB-cluster3\fR, \fB-cluster4\fR, \fB-cluster8\fR). .LP A space filling curve halftoning method using the Hilbert curve is also available (\fB-hilbert\fR). .LP Floyd-Steinberg will almost always give the best looking results; however, looking good is not always what you want. For instance, thresholding can be used in a pipeline with the \fBpnmconvol\fR tool, for tasks like edge and peak detection. And clustered-dot dithering gives a newspaper-ish look, a useful special effect. .LP The \fB-value\fR option alters the thresholding value for Floyd-Steinberg and simple thresholding. It should be a real number between 0 and 1. Above 0.5 means darker images; below 0.5 means lighter. .LP The Hilbert curve method is useful for processing images before display on devices that do not render individual pixels distinctly (like laser printers). This dithering method can give better results than the dithering usually done by the laser printers themselves. The \fB-clump\fR option alters the number of pixels in a clump. This is usually an integer between 2 and 100 (default 5). Smaller clump sizes smear the image less and are less grainy, but seem to loose some grey scale linearity. Typically a PGM image will have to be scaled to fit on a laser printer page (2400 x 3000 pixels for an A4 300 dpi page), and then dithered to a PBM image before being converted to a postscript file. A printing pipeline might look something like: .DS L pamscale -xysize 2400 3000 image.pgm | pamditherbw -hilbert | \ pamtopnm | pnmtops -scale 0.25 > image.ps .DE .LP All options can be abbreviated to their shortest unique prefix. .SH 2 REFERENCES .LP .LP The only reference you need for this stuff is "Digital Halftoning" by Robert Ulichney, MIT Press, ISBN 0-262-21009-6. .LP The Hilbert curve space filling method is taken from "Digital Halftoning with Space Filling Curves" by Luiz Velho, Computer Graphics Volume 25, Number 4, proceedings of SIGRAPH '91, page 81. ISBN 0-89791-436-8 .SH 2 SEE ALSO .LP pamtopnm, pgmtopgm, pbmtopgm, pamthreshold, pbmreduce, pnmconvol, pamscale, pam, pnm, .SH 2 HISTORY .LP .LP \fBpamditherbw\fR was new in Netpbm 10.23 (July 2004), but is essentially the same program as \fBpgmtopbm\fR that has existed practically since the beginning. \fBpamditherbw\fR differs from its predecessor in that it properly deals with gamma adjustment and that it accepts PAM input in addition to PGM and PBM and produces PAM output. .LP \fBpamditherbw\fR obsoletes \fBpgmtopbm\fR. .SH 2 AUTHOR .LP Copyright (C) 1989 by Jef Poskanzer. .br \l'5i' .SH 2 Table Of Contents .LP .IP \(bu SYNOPSIS .IP \(bu DESCRIPTION .IP \(bu OPTIONS .IP \(bu REFERENCES .IP \(bu SEE ALSO .IP \(bu AUTHOR .LP