summary refs log tree commit diff
path: root/pbmclean.html
blob: 3f146e3e545bcf4e47dadf92bf90495773b54ce6 (plain) (blame)
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
156
157
158
159
160
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Pbmclean User Manual</title></head>
<body>
<h1>pbmclean</h1>
Updated: 19 November 2011
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>
pbmclean - despeckle a PBM image

<h2 id="synopsis">SYNOPSIS</h2>

<b>pbmclean</b>
[<b>-minneighbors=</b><i>N</i>]
[<b>-black</b>|<b>-white</b>]
[<b>-extended</b>]
[<i>pbmfile</i>]

<?makeman .SH OPTION USAGE ?>
<p>You can use the minimum unique abbreviation of the options.  You
can use two hyphens instead of one.  You can separate an option name
from its value with white space instead of an equals sign.

<h2 id="description">DESCRIPTION</h2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>pbmclean</b> cleans up a PBM image of random specks.  It reads a
PBM image as input and outputs a PBM that is the same as the input
except with isolated pixels inverted.

<p>You can use <b>pbmclean </b> to clean up "snow" on bitmap
images.

<p>There are two ways <b>pbmclean</b> can define "isolated" pixels:
simple and extended.  When you specify <b>-extended</b>, <b>pbmclean</b>
uses extended; otherwise it uses basic.

<h3 id="basic">Basic Mode</h3>

<p>In basic mode, <b>pbmclean</b> looks at each pixel individually, and any
pixel that doesn't have at least a minimum number of pixels of the same color
touching it is considered isolated and <b>pbmclean</b> erases it.

<p>The <b>-minneighbors</b> option specifies the minimum number of neighboring
pixels of the same color for a pixel <em>not</em> to be considered
isolated.

<p>For example, if <b>-minneighbors</b> is two and there are two contiguous
black pixels in an otherwise white field, each of those pixels is isolated,
so <b>pbmclean</b> erases them - turns both white.

<p>The default minimum 1 pixel &mdash; <b>pbmclean</b> flips only completely
isolated pixels.

<p>(A <b>-minneighbors</b> value greater than 8 generates a completely
inverted image (but use <b>pnminvert</b> to do that) -- or a
completely white or completely black image with the <b>-black</b> or
<b>-white</b> option).

<p><b>pbmclean</b> considers the area beyond the edges of the image to
be white.  (This matters when you consider pixels right on the edge of
the image).

<p><b>pbmclean</b> does not distinguish between foreground and background; by
default, it flips isolated pixels of either color.  But you can
specify <b>-black</b> or <b>-white</b> to have it flip only pixels of one
color.

<h3 id="extended">Extended Mode</h3>

<p>In extended mode, <b>pbmclean</b> erases all blobs which don't have the
specified minimum number of pixels.  A blob is a set of contiguous pixels of
the foreground color.  The minimum number of pixels is one plus
the <b>-minneighbors</b> value.  You specify the foreground color with
<b>-black</b> and <b>-white</b> (default is black).

<p>For example, if <b>-minneighbors</b> is 2 and the foreground color is
black, and the image contains a straight line 4 pixels long, <b>pbmclean</b>
erases that -- turns all four pixels white.  <b>pbmclean</b> also erases
4 pixels in a square or L-shape.

<p>The default <b>-minneighbors</b> is 4, so a blob must have at least 5
pixels to escape <b>pbmclean</b>'s purge.

<p>Extended mode was new in Netpbm 10.56 (September 2011).


<h2 id="options">OPTIONS</h2>

<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>pbmclean</b> recognizes the following
command line options:

<dl compact>
<dt><b>-black</b>

<dt><b>-white</b>

<dd>Flip pixels of the specified color.  By default, if you specify
neither <b>-black</b> nor <b>-white</b>, <b>pbmclean</b> flips both
black and white pixels which do not have sufficient identical
neighbors.  If you specify <b>-black</b>, <b>pbmclean</b> leaves the
white pixels alone and just erases isolated black pixels.  Vice versa
for <b>-white</b>.  You may specify both <b>-black</b> and
<b>-white</b> to get the same as the default behavior.

<dt><b>-minneighbors=</b><i>N</i>

<dd>This determines how many pixels must be in a cluster in order
for <b>pbmclean</b> to consider them legitimate and not clean them
out of the image.  See <a href="#description">Description</a>.

<p>Before December 2001, <b>pbmclean</b> accepted <b>-</b><i>N</i>
instead of <b>-minneighbors</b>.  Before Netpbm 10.27 (March 2005),
<b>-minneighbors</b> was <b>-minneighbor</b>.

<dt><b>-extended</b>

<dd><b>pbmclean</b> uses extended, as opposed to basic, isolated pixel
detection.

<p>This option was new in Netpbm 10.56 (September 2011).

</dl>

<h2 id="seealso">SEE ALSO</h2>

<b><a href="pbm.html">pbm</a></b>

<h2 id="author">AUTHOR</h2>

Copyright (C) 1990 by Angus Duggan
Copyright (C) 1989 by Jef Poskanzer.
Copyright (C) 2001 by Michael Sternberg.
<p>
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.  This software is provided "as is" without express or
implied warranty.

<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
  <ul>
  <li><a href="#basic">Basic Mode</a>
  <li><a href="#extended">Extended Mode</a>
  </ul>
<li><a href="#options">OPTIONS</a>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#author">AUTHOR</a>
</ul>
</body>
</html>