1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pamditherbw User Manual</TITLE></HEAD>
<BODY>
<H1>pamditherbw</H1>
Updated: 20 June 2004
<BR>
<A HREF="#index">Table Of Contents</A>
<H2>NAME</H2>
pamditherbw - dither grayscale image to black and white
<H2 id="synopsis">SYNOPSIS</H2>
<B>pamditherbw</B>
[<B>-floyd</B> | <B>-fs</B> | <B>-threshold</B>
| <B>-hilbert</B>
| <B>-dither8</B> | <B>-d8</B> | <B>-cluster3</B>
| <B>-c3</B> | <B>-cluster4</B> | <B>-c4</B>
| <B>-cluster8</B> | <B>-c8</B>]
[<B>-value</B> <I>val</I>]
[<B>-clump</B> <I>size</I>]
[<I>pamfile</I>]
<H2 id="description">DESCRIPTION</H2>
<p>This program is part of <a href="index.html">Netpbm</a>.
<P><B>pamditherbw</b> 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.
<p>The input should be a PGM image or a PAM image of tuple type
GRAYSCALE. However, <b>pamditherbw</b> 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).
<p>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 <b>pamtopnm</b>.
<P>To do the opposite of dithering, you can usually just scale the image
down and then back up again with <b>pamscale</b>, possibly smoothing or
blurring the result with <b>pnmsmooth</b> or <b>pnmconvol</b>. Or use
the special case program <b>pbmtopgm</b>.
<p>To dither a color image (to reduce the number of pixel colors),
use <b>ppmdither</b>.
<p>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 <b>pamditherbw</b> does very simple
thresholding with its <b>-threshold</b> option. But <b>pamthreshold</b>
does more sophisticated thresholding.
<H2 id="options">OPTIONS</H2>
<P>The default quantization method is boustrophedonic Floyd-Steinberg
error diffusion (<B>-floyd</B> or <B>-fs</B>).
<p>Also available are simple thresholding (<B>-threshold</B>); Bayer's
ordered dither (<B>-dither8</B>) with a 16x16 matrix; and three
different sizes of 45-degree clustered-dot dither (<B>-cluster3</B>,
<B>-cluster4</B>, <B>-cluster8</B>).
<p>A space filling curve halftoning method using the Hilbert curve is
also available (<B>-hilbert</B>).
<P>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 <b>pnmconvol</b> tool,
for tasks like edge and peak detection. And clustered-dot dithering
gives a newspaper-ish look, a useful special effect.
<P>The <B>-value</B> 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.
<P>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
<B>-clump</B> 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:
<pre>
pamscale -xysize 2400 3000 image.pgm | pamditherbw -hilbert | \
pamtopnm | pnmtops -scale 0.25 > image.ps
</pre>
<P>All options can be abbreviated to their shortest unique prefix.
<H2 id="references">REFERENCES</H2>
<p>The only reference you need for this stuff is "Digital
Halftoning" by Robert Ulichney, MIT Press, ISBN 0-262-21009-6.
<P>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
<H2 id="seealso">SEE ALSO</H2>
<A HREF="pamtopnm.html">pamtopnm</A>,
<A HREF="pgmtopgm.html">pgmtopgm</A>,
<A HREF="pbmtopgm.html">pbmtopgm</A>,
<A HREF="pamthreshold.html">pamthreshold</A>,
<A HREF="pbmreduce.html">pbmreduce</A>,
<A HREF="pnmconvol.html">pnmconvol</A>,
<A HREF="pamscale.html">pamscale</A>,
<A HREF="pam.html">pam</A>,
<A HREF="pnm.html">pnm</A>,
<H2 id="history">HISTORY</H2>
<p><b>pamditherbw</b> was new in Netpbm 10.23 (July 2004), but is
essentially the same program as <b>pgmtopbm</b> that has existed
practically since the beginning. <b>pamditherbw</b> 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.
<p><b>pamditherbw</b> obsoletes <b>pgmtopbm</b>.
<H2 id="author">AUTHOR</H2>
Copyright (C) 1989 by Jef Poskanzer.
<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#references">REFERENCES</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>
|