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 "Pbmclean User Manual" 0 "19 November 2011" "netpbm documentation"
7
8.SH NAME
9
10pbmclean - despeckle a PBM image
11
12.UN synopsis
13.SH SYNOPSIS
14
15\fBpbmclean\fP
16[\fB-minneighbors=\fP\fIN\fP]
17[\fB-black\fP|\fB-white\fP]
18[\fB-extended\fP]
19[\fIpbmfile\fP]
20
21.SH OPTION USAGE
22.PP
23You can use the minimum unique abbreviation of the options.  You
24can use two hyphens instead of one.  You can separate an option name
25from its value with white space instead of an equals sign.
26
27.UN description
28.SH DESCRIPTION
29.PP
30This program is part of
31.BR "Netpbm" (1)\c
32\&.
33.PP
34\fBpbmclean\fP cleans up a PBM image of random specks.  It reads a
35PBM image as input and outputs a PBM that is the same as the input
36except with isolated pixels inverted.
37.PP
38You can use \fBpbmclean \fP to clean up "snow" on bitmap
39images.
40.PP
41There are two ways \fBpbmclean\fP can define "isolated" pixels:
42simple and extended.  When you specify \fB-extended\fP, \fBpbmclean\fP
43uses extended; otherwise it uses basic.
44
45.UN basic
46.SS
47.PP
48In basic mode, \fBpbmclean\fP looks at each pixel individually, and any
49pixel that doesn't have at least a minimum number of pixels of the same color
50touching it is considered isolated and \fBpbmclean\fP erases it.
51.PP
52The \fB-minneighbors\fP option specifies the minimum number of neighboring
53pixels of the same color for a pixel \fInot\fP to be considered
54isolated.
55.PP
56For example, if \fB-minneighbors\fP is two and there are two contiguous
57black pixels in an otherwise white field, each of those pixels is isolated,
58so \fBpbmclean\fP erases them - turns both white.
59.PP
60The default minimum 1 pixel - \fBpbmclean\fP flips only completely
61isolated pixels.
62.PP
63(A \fB-minneighbors\fP value greater than 8 generates a completely
64inverted image (but use \fBpnminvert\fP to do that) -- or a
65completely white or completely black image with the \fB-black\fP or
66\fB-white\fP option).
67.PP
68\fBpbmclean\fP considers the area beyond the edges of the image to
69be white.  (This matters when you consider pixels right on the edge of
70the image).
71.PP
72\fBpbmclean\fP does not distinguish between foreground and background; by
73default, it flips isolated pixels of either color.  But you can
74specify \fB-black\fP or \fB-white\fP to have it flip only pixels of one
75color.
76
77.UN extended
78.SS
79.PP
80In extended mode, \fBpbmclean\fP erases all blobs which don't have the
81specified minimum number of pixels.  A blob is a set of contiguous pixels of
82the foreground color.  The minimum number of pixels is one plus
83the \fB-minneighbors\fP value.  You specify the foreground color with
84\fB-black\fP and \fB-white\fP (default is black).
85.PP
86For example, if \fB-minneighbors\fP is 2 and the foreground color is
87black, and the image contains a straight line 4 pixels long, \fBpbmclean\fP
88erases that -- turns all four pixels white.  \fBpbmclean\fP also erases
894 pixels in a square or L-shape.
90.PP
91The default \fB-minneighbors\fP is 4, so a blob must have at least 5
92pixels to escape \fBpbmclean\fP's purge.
93.PP
94Extended mode was new in Netpbm 10.56 (September 2011).
95
96
97.UN options
98.SH OPTIONS
99
100
101.TP
102\fB-black\fP
103
104.TP
105\fB-white\fP
106Flip pixels of the specified color.  By default, if you specify
107neither \fB-black\fP nor \fB-white\fP, \fBpbmclean\fP flips both
108black and white pixels which do not have sufficient identical
109neighbors.  If you specify \fB-black\fP, \fBpbmclean\fP leaves the
110white pixels alone and just erases isolated black pixels.  Vice versa
111for \fB-white\fP.  You may specify both \fB-black\fP and
112\fB-white\fP to get the same as the default behavior.
113
114.TP
115\fB-minneighbors=\fP\fIN\fP
116This determines how many pixels must be in a cluster in order
117for \fBpbmclean\fP to consider them legitimate and not clean them
118out of the image.  See
119.UR #description
120Description
121.UE
122\&.
123.sp
124Before December 2001, \fBpbmclean\fP accepted \fB-\fP\fIN\fP
125instead of \fB-minneighbors\fP.  Before Netpbm 10.27 (March 2005),
126\fB-minneighbors\fP was \fB-minneighbor\fP.
127
128.TP
129\fB-extended\fP
130\fBpbmclean\fP uses extended, as opposed to basic, isolated pixel
131detection.
132.sp
133This option was new in Netpbm 10.56 (September 2011).
134
135
136
137.UN seealso
138.SH SEE ALSO
139.BR "pbm" (5)\c
140\&
141
142.UN author
143.SH AUTHOR
144
145Copyright (C) 1990 by Angus Duggan
146Copyright (C) 1989 by Jef Poskanzer.
147Copyright (C) 2001 by Michael Sternberg.
148.PP
149Permission to use, copy, modify, and distribute this software and its
150documentation for any purpose and without fee is hereby granted, provided
151that the above copyright notice appear in all copies and that both that
152copyright notice and this permission notice appear in supporting
153documentation.  This software is provided "as is" without express or
154implied warranty.
155.SH DOCUMENT SOURCE
156This manual page was generated by the Netpbm tool 'makeman' from HTML
157source.  The master documentation is at
158.IP
159.B http://netpbm.sourceforge.net/doc/pbmclean.html
160.PP