\ .\" This man page was generated by the Netpbm tool 'makeman' from HTML source. .\" Do not hand-hack it! If you have bug fixes or improvements, please find .\" the corresponding HTML page on the Netpbm website, generate a patch .\" against that, and send it to the Netpbm maintainer. .TH "Pamditherbw User Manual" 0 "10 May 2010" "netpbm documentation" .SH NAME pamditherbw - dither grayscale image to black and white .UN synopsis .SH SYNOPSIS \fBpamditherbw\fP [\fB-floyd\fP | \fB-fs\fP | \fB-atkinson\fP | \fB-threshold\fP | \fB-hilbert\fP | \fB-dither8\fP | \fB-d8\fP | \fB-cluster3\fP | \fB-c3\fP | \fB-cluster4\fP | \fB-c4\fP | \fB-cluster8\fP | \fB-c8\fP] [\fB-value\fP \fIval\fP] [\fB-clump\fP \fIsize\fP] [\fB-randomseed=\fP\fIinteger\fP] [\fIpamfile\fP] .PP All options can be abbreviated to their shortest unique prefix. .UN description .SH DESCRIPTION .PP This program is part of .BR "Netpbm" (1)\c \&. .PP \fBpamditherbw\fP 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. .PP The input should be a PGM image or a PAM image of tuple type GRAYSCALE. However, \fBpamditherbw\fP 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). .PP 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\fP. .PP To do the opposite of dithering, you can usually just scale the image down and then back up again with \fBpamscale\fP, possibly smoothing or blurring the result with \fBpnmsmooth\fP or \fBpnmconvol\fP. Or use the special case program \fBpbmtopgm\fP. .PP To dither a color image (to reduce the number of pixel colors), use \fBppmdither\fP. .PP 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 whether its brightness is above or below a threshold. That threshold might vary. Simple thresholding is a degenerate case of dithering, so \fBpamditherbw\fP does very simple thresholding with its \fB-threshold\fP option. But \fBpamthreshold\fP does more sophisticated thresholding. .PP If all you want is to change a PGM image with maxval 1 to a PBM image, \fBpamtopnm\fP will do that. .UN options .SH OPTIONS .PP The default quantization method is boustrophedonic Floyd-Steinberg error diffusion (\fB-floyd\fP or \fB-fs\fP). .PP Also available are simple thresholding (\fB-threshold\fP); Bayer's ordered dither (\fB-dither8\fP) with a 16x16 matrix; .UR http://www.tinrocket.com/projects/programming/graphics/00158/ Atkinson .UE \&; and three different sizes of 45-degree clustered-dot dither (\fB-cluster3\fP, \fB-cluster4\fP, \fB-cluster8\fP). .PP A space filling curve halftoning method using the Hilbert curve is also available (\fB-hilbert\fP). .PP Floyd-Steinberg or Atkinson will almost always give the best looking results; however, looking good is not always what you want. For instance, you can use thresholding in a pipeline with the \fBpnmconvol\fP, for tasks such as edge and peak detection. And clustered-dot dithering gives a newspaper-ish look, a useful special effect. .PP Floyd-Steinberg is by far the more traditional, but .UR http://www.tinrocket.com/projects/programming/graphics/00158/ some claim .UE \& Atkinson works better. .PP 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\fP option alters the number of pixels in a clump. 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: .nf pamscale -xysize 2400 3000 image.pgm | pamditherbw -hilbert | \e pamtopnm | pnmtops -scale 0.25 > image.ps .fi .TP \fB-value\fP This option alters the thresholding value for Floyd-Steinberg, Atkinson, and simple thresholding. It should be a real number between 0 and 1. Above 0.5 means darker images; below 0.5 means lighter. .TP \fB-clump\fP This 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 lose some grey scale linearity. .TP \fB-randomseed=\fP\fIinteger\fP This is the seed for the random number generator that generates the pixels. .sp Use this to ensure you get the same image on separate invocations. .sp By default, \fBpgmnoise\fP uses a seed derived from the time of day and process ID, which gives you fairly uncorrelated results in multiple invocations. .sp This option was new in Netpbm 10.45 (December 2008). .UN references .SH REFERENCES .PP The only reference you need for this stuff is "Digital Halftoning" by Robert Ulichney, MIT Press, ISBN 0-262-21009-6. .PP 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 .UN seealso .SH SEE ALSO .BR "pamtopnm" (1)\c \&, .BR "pgmtopgm" (1)\c \&, .BR "pbmtopgm" (1)\c \&, .BR "pamthreshold" (1)\c \&, .BR "pbmreduce" (1)\c \&, .BR "pnmconvol" (1)\c \&, .BR "pamscale" (1)\c \&, .BR "pam" (5)\c \&, .BR "pnm" (5)\c \&, .UN history .SH HISTORY .PP \fBpamditherbw\fP was new in Netpbm 10.23 (July 2004), but is essentially the same program as \fBpgmtopbm\fP that has existed practically since the beginning. \fBpamditherbw\fP differs from its predecessor in that it properly adds brightnesses (using gamma transformations; \fBpgmtopbm\fP just adds them linearly) and that it accepts PAM input in addition to PGM and PBM and produces PAM output. .PP \fBpamditherbw\fP obsoletes \fBpgmtopbm\fP. .PP \fB-atkinson\fP was new in Netpbm 10.38 (March 2007). .UN author .SH AUTHOR Copyright (C) 1989 by Jef Poskanzer. .SH DOCUMENT SOURCE This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at .IP .B http://netpbm.sourceforge.net/doc/pamditherbw.html .PP