Debian Codegraph @

upstream/debian-unstable/man1/pamditherbw.1

raw
1 \
2 .\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
3 .\" Do not hand-hack it! If you have bug fixes or improvements, please find
4 .\" the corresponding HTML page on the Netpbm website, generate a patch
5 .\" against that, and send it to the Netpbm maintainer.
6 .TH "Pamditherbw User Manual" 1 "10 May 2010" "netpbm documentation"
7
8 .SH NAME
9
10 pamditherbw - dither grayscale image to black and white
11
12 .UN synopsis
13 .SH SYNOPSIS
14
15 \fBpamditherbw\fP
16
17 [\fB-floyd\fP | \fB-fs\fP
18 | \fB-atkinson\fP
19 | \fB-threshold\fP
20 | \fB-hilbert\fP
21 | \fB-dither8\fP | \fB-d8\fP | \fB-cluster3\fP
22 | \fB-c3\fP | \fB-cluster4\fP | \fB-c4\fP
23 | \fB-cluster8\fP | \fB-c8\fP]
24
25 [\fB-value\fP \fIval\fP]
26
27 [\fB-clump\fP \fIsize\fP]
28
29 [\fB-randomseed=\fP\fIinteger\fP]
30
31 [\fIpamfile\fP]
32 .PP
33 All options can be abbreviated to their shortest unique prefix.
34
35 .UN description
36 .SH DESCRIPTION
37 .PP
38 This program is part of
39 .BR "Netpbm" (1)\c
40 \&.
41 .PP
42 \fBpamditherbw\fP dithers a grayscale image. Dithering means turning
43 each shade of gray into a pattern of black and white pixels that, from
44 a distance, look the same as the gray.
45 .PP
46 The input should be a PGM image or a PAM image of tuple type
47 GRAYSCALE. However, \fBpamditherbw\fP doesn't check, so if you feed
48 it e.g. a PPM image, it will produce arbitrary results (actually, it
49 just takes the first channel of whatever you give it and treats it as
50 if it represented gray levels).
51 .PP
52 The output is a PAM with tuple type BLACKANDWHITE. You can turn
53 this into a PBM (if you need to use it with an older program that doesn't
54 understand PAM) with \fBpamtopnm\fP.
55 .PP
56 To do the opposite of dithering, you can usually just scale the image
57 down and then back up again with \fBpamscale\fP, possibly smoothing or
58 blurring the result with \fBpnmsmooth\fP or \fBpnmconvol\fP. Or use
59 the special case program \fBpbmtopgm\fP.
60 .PP
61 To dither a color image (to reduce the number of pixel colors),
62 use \fBppmdither\fP.
63 .PP
64 Another way to convert a grayscale image to a black and white image
65 is thresholding. Thresholding is simply replacing each grayscale pixel
66 with a black or white pixel depending on whether its brightness is above or
67 below a threshold. That threshold might vary. Simple thresholding is a
68 degenerate case of dithering, so \fBpamditherbw\fP does very simple
69 thresholding with its \fB-threshold\fP option. But \fBpamthreshold\fP
70 does more sophisticated thresholding.
71 .PP
72 If all you want is to change a PGM image with maxval 1 to a PBM image,
73 \fBpamtopnm\fP will do that.
74
75
76 .UN options
77 .SH OPTIONS
78 .PP
79 In addition to the options common to all programs based on libnetpbm
80 (most notably \fB-quiet\fP, see
81 .UR index.html#commonoptions
82 Common Options
83 .UE
84 \&), \fBpamditherbw\fP recognizes the following
85 command line options:
86
87 .UN quantmethod
88 .SS Quantization Method
89 .PP
90 The default quantization method is boustrophedonic Floyd-Steinberg
91 error diffusion (\fB-floyd\fP or \fB-fs\fP).
92 .PP
93 Also available are simple thresholding (\fB-threshold\fP); Bayer's
94 ordered dither (\fB-dither8\fP) with a 16x16 matrix;
95 .UR http://www.tinrocket.com/projects/programming/graphics/00158/
96 Atkinson
97 .UE
98 \&; and three different sizes of 45-degree clustered-dot
99 dither (\fB-cluster3\fP, \fB-cluster4\fP, \fB-cluster8\fP).
100 .PP
101 A space filling curve halftoning method using the Hilbert curve is
102 also available (\fB-hilbert\fP).
103 .PP
104 Floyd-Steinberg or Atkinson will almost always give the best
105 looking results; however, looking good is not always what you want.
106 For instance, you can use thresholding in a pipeline with the
107 \fBpnmconvol\fP, for tasks such as edge and peak detection. And
108 clustered-dot dithering gives a newspaper-ish look, a useful special
109 effect.
110 .PP
111 Floyd-Steinberg is by far the more traditional, but
112 .UR http://www.tinrocket.com/projects/programming/graphics/00158/
113 some claim
114 .UE
115 \& Atkinson works better.
116 .PP
117 The Hilbert curve method is useful for processing images before
118 display on devices that do not render individual pixels distinctly
119 (like laser printers). This dithering method can give better results
120 than the dithering usually done by the laser printers themselves. The
121 \fB-clump\fP option alters the number of pixels in a clump. Typically a PGM
122 image will have to be scaled to fit on a laser printer page (2400 x 3000
123 pixels for an A4 300 dpi page), and then dithered to a PBM image before being
124 converted to a postscript file. A printing pipeline might look something
125 like:
126
127 .nf
128 pamscale -xysize 2400 3000 image.pgm | pamditherbw -hilbert | \e
129 pamtopnm | pnmtops -scale 0.25 > image.ps
130
131 .fi
132
133 .UN otheropts
134 .SS Other Options
135
136
137
138 .TP
139 \fB-value\fP
140 This option alters the thresholding value for Floyd-Steinberg,
141 Atkinson, and simple thresholding. It should be a real number between
142 0 and 1. Above 0.5 means darker images; below 0.5 means lighter.
143
144 .TP
145 \fB-clump\fP
146 This option alters the number of pixels in a clump when the
147 Hilbert curve method is used. This is usually an integer between 2
148 and 100 (default 5). Smaller clump sizes smear the image less and are
149 less grainy, but seem to lose some grey scale linearity.
150
151 .TP
152 \fB-randomseed=\fP\fIinteger\fP
153 The Floyd-Steiberg and Atkinson methods use random numbers to
154 diffuse the error. This is the seed for the random number generator.
155 The other methods do not employ random numbers and ignore this option.
156 .sp
157 Use this to ensure you get the same image on separate invocations.
158 .sp
159 By default, \fBpamditherbw\fP uses a seed derived from the time of day
160 and process ID, which gives you fairly uncorrelated results in multiple
161 invocations.
162 .sp
163 This option was new in Netpbm 10.45 (December 2008).
164
165
166
167
168 .UN references
169 .SH REFERENCES
170 .PP
171 The only reference you need for this stuff is "Digital
172 Halftoning" by Robert Ulichney, MIT Press, ISBN 0-262-21009-6.
173 .PP
174 The Hilbert curve space filling method is taken from "Digital
175 Halftoning with Space Filling Curves" by Luiz Velho, Computer
176 Graphics Volume 25, Number 4, proceedings of SIGRAPH '91, page
177 81. ISBN 0-89791-436-8
178
179 .UN seealso
180 .SH SEE ALSO
181 .BR "pamtopnm" (1)\c
182 \&,
183 .BR "pgmtopgm" (1)\c
184 \&,
185 .BR "pbmtopgm" (1)\c
186 \&,
187 .BR "pamthreshold" (1)\c
188 \&,
189 .BR "pbmreduce" (1)\c
190 \&,
191 .BR "pnmconvol" (1)\c
192 \&,
193 .BR "pamscale" (1)\c
194 \&,
195 .BR "pam" (1)\c
196 \&,
197 .BR "pnm" (1)\c
198 \&,
199
200 .UN history
201 .SH HISTORY
202 .PP
203 \fBpamditherbw\fP was new in Netpbm 10.23 (July 2004), but is
204 essentially the same program as \fBpgmtopbm\fP that has existed
205 practically since the beginning. \fBpamditherbw\fP differs from its
206 predecessor in that it properly adds brightnesses (using gamma
207 transformations; \fBpgmtopbm\fP just adds them linearly) and that it
208 accepts PAM input in addition to PGM and PBM and produces PAM output.
209 .PP
210 \fBpamditherbw\fP obsoletes \fBpgmtopbm\fP.
211 .PP
212 \fB-atkinson\fP was new in Netpbm 10.38 (March 2007).
213
214 .UN author
215 .SH AUTHOR
216
217 Copyright (C) 1989 by Jef Poskanzer.
218 .SH DOCUMENT SOURCE
219 This manual page was generated by the Netpbm tool 'makeman' from HTML
220 source. The master documentation is at
221 .IP
222 .B http://netpbm.sourceforge.net/doc/pamditherbw.html
223 .PP