1Pamditherbw User Manual(0)                          Pamditherbw User Manual(0)
2
3
4

NAME

6       pamditherbw - dither grayscale image to black and white
7
8

SYNOPSIS

10       pamditherbw
11
12       [-floyd  |  -fs  | -atkinson | -threshold | -hilbert | -dither8 | -d8 |
13       -cluster3 | -c3 | -cluster4 | -c4 | -cluster8 | -c8]
14
15       [-value val]
16
17       [-clump size]
18
19       [-randomseed=integer]
20
21       [pamfile]
22
23       All options can be abbreviated to their shortest unique prefix.
24
25

DESCRIPTION

27       This program is part of Netpbm(1).
28
29       pamditherbw dithers a grayscale image.  Dithering  means  turning  each
30       shade  of  gray  into  a pattern of black and white pixels that, from a
31       distance, look the same as the gray.
32
33       The input should be a PGM image or a PAM image of tuple type GRAYSCALE.
34       However, pamditherbw doesn't check, so if you feed it e.g. a PPM image,
35       it will produce arbitrary results (actually, it just  takes  the  first
36       channel of whatever you give it and treats it as if it represented gray
37       levels).
38
39       The output is a PAM with tuple type BLACKANDWHITE.  You can  turn  this
40       into  a  PBM  (if you need to use it with an older program that doesn't
41       understand PAM) with pamtopnm.
42
43       To do the opposite of dithering, you can usually just scale  the  image
44       down  and then back up again with pamscale, possibly smoothing or blur‐
45       ring the result with pnmsmooth or pnmconvol.  Or use the  special  case
46       program pbmtopgm.
47
48       To dither a color image (to reduce the number of pixel colors), use pp‐
49       mdither.
50
51       Another way to convert a grayscale image to a black and white image  is
52       thresholding.   Thresholding  is  simply replacing each grayscale pixel
53       with a black or white pixel depending  on  whether  its  brightness  is
54       above or below a threshold.  That threshold might vary.  Simple thresh‐
55       olding is a degenerate case of dithering, so pamditherbw does very sim‐
56       ple  thresholding  with  its  -threshold option.  But pamthreshold does
57       more sophisticated thresholding.
58
59       If all you want is to change a PGM image with maxval 1 to a PBM  image,
60       pamtopnm will do that.
61
62
63

OPTIONS

65       In  addition  to  the options common to all programs based on libnetpbm
66       (most notably -quiet, see
67        Common Options ⟨index.html#commonoptions⟩  ),  pamditherbw  recognizes
68       the following command line options:
69
70
71   Quantization Method
72       The  default quantization method is boustrophedonic Floyd-Steinberg er‐
73       ror diffusion (-floyd or -fs).
74
75       Also available are simple thresholding  (-threshold);  Bayer's  ordered
76       dither (-dither8) with a 16x16 matrix;
77        Atkinson
78http://www.tinrocket.com/projects/programming/graphics/00158/⟩  ;  and
79       three  different  sizes  of  45-degree clustered-dot dither (-cluster3,
80       -cluster4, -cluster8).
81
82       A space filling curve halftoning method using the Hilbert curve is also
83       available (-hilbert).
84
85       Floyd-Steinberg  or  Atkinson  will almost always give the best looking
86       results; however, looking good is not always what you  want.   For  in‐
87       stance,  you can use thresholding in a pipeline with the pnmconvol, for
88       tasks such as edge and peak  detection.   And  clustered-dot  dithering
89       gives a newspaper-ish look, a useful special effect.
90
91       Floyd-Steinberg is by far the more traditional, but
92        some                                                             claim
93http://www.tinrocket.com/projects/programming/graphics/00158/⟩  Atkin‐
94       son works better.
95
96       The Hilbert curve method is useful for processing images before display
97       on devices that do not render individual pixels distinctly (like  laser
98       printers).   This  dithering  method  can  give better results than the
99       dithering usually done by the laser printers  themselves.   The  -clump
100       option  alters  the number of pixels in a clump.  Typically a PGM image
101       will have to be scaled to fit on a laser printer page (2400 x 3000 pix‐
102       els  for  an  A4 300 dpi page), and then dithered to a PBM image before
103       being converted to a postscript file.  A printing pipeline  might  look
104       something like:
105
106           pamscale -xysize 2400 3000 image.pgm | pamditherbw -hilbert |  \
107             pamtopnm | pnmtops -scale 0.25 > image.ps
108
109
110
111   Other Options
112       -value This  option  alters the thresholding value for Floyd-Steinberg,
113              Atkinson, and simple thresholding.  It should be a  real  number
114              between 0 and 1.  Above 0.5 means darker images; below 0.5 means
115              lighter.
116
117
118       -clump This option alters the number of pixels  in  a  clump  when  the
119              Hilbert  curve  method  is used.  This is usually an integer be‐
120              tween 2 and 100 (default 5).  Smaller clump sizes smear the  im‐
121              age  less  and are less grainy, but seem to lose some grey scale
122              linearity.
123
124
125       -randomseed=integer
126              The Floyd-Steiberg and Atkinson methods use  random  numbers  to
127              diffuse  the error.  This is the seed for the random number gen‐
128              erator.  The other methods do not employ random numbers and  ig‐
129              nore this option.
130
131              Use  this  to  ensure you get the same image on separate invoca‐
132              tions.
133
134              By default, pamditherbw uses a seed derived from the time of day
135              and  process  ID, which gives you fairly uncorrelated results in
136              multiple invocations.
137
138              This option was new in Netpbm 10.45 (December 2008).
139
140
141
142
143

REFERENCES

145       The only reference you need for this stuff is "Digital  Halftoning"  by
146       Robert Ulichney, MIT Press, ISBN 0-262-21009-6.
147
148       The  Hilbert curve space filling method is taken from "Digital Halfton‐
149       ing with Space Filling Curves" by Luiz Velho, Computer Graphics  Volume
150       25, Number 4, proceedings of SIGRAPH '91, page 81. ISBN 0-89791-436-8
151
152

SEE ALSO

154       pamtopnm(1),  pgmtopgm(1),  pbmtopgm(1), pamthreshold(1), pbmreduce(1),
155       pnmconvol(1), pamscale(1), pam(1), pnm(1),
156
157

HISTORY

159       pamditherbw was new in Netpbm 10.23 (July 2004), but is essentially the
160       same  program as pgmtopbm that has existed practically since the begin‐
161       ning.  pamditherbw differs from its predecessor  in  that  it  properly
162       adds brightnesses (using gamma transformations; pgmtopbm just adds them
163       linearly) and that it accepts PAM input in addition to PGM and PBM  and
164       produces PAM output.
165
166       pamditherbw obsoletes pgmtopbm.
167
168       -atkinson was new in Netpbm 10.38 (March 2007).
169
170

AUTHOR

172       Copyright (C) 1989 by Jef Poskanzer.
173

DOCUMENT SOURCE

175       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
176       source.  The master documentation is at
177
178              http://netpbm.sourceforge.net/doc/pamditherbw.html
179
180netpbm documentation              10 May 2010       Pamditherbw User Manual(0)
Impressum