summaryrefslogtreecommitdiffstats
path: root/upstream/debian-unstable/man1/pbmclean.1
blob: 4d22c2f586be349124d2bc4376ad079e84bc7207 (plain)
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
161
162
163
164
165
166
167
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pbmclean User Manual" 1 "19 November 2011" "netpbm documentation"

.SH NAME
pbmclean - despeckle a PBM image

.UN synopsis
.SH SYNOPSIS

\fBpbmclean\fP
[\fB-minneighbors=\fP\fIN\fP]
[\fB-black\fP|\fB-white\fP]
[\fB-extended\fP]
[\fIpbmfile\fP]

.SH OPTION USAGE
.PP
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.

.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpbmclean\fP 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.
.PP
You can use \fBpbmclean \fP to clean up "snow" on bitmap
images.
.PP
There are two ways \fBpbmclean\fP can define "isolated" pixels:
simple and extended.  When you specify \fB-extended\fP, \fBpbmclean\fP
uses extended; otherwise it uses basic.

.UN basic
.SS Basic Mode
.PP
In basic mode, \fBpbmclean\fP 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 \fBpbmclean\fP erases it.
.PP
The \fB-minneighbors\fP option specifies the minimum number of neighboring
pixels of the same color for a pixel \fInot\fP to be considered
isolated.
.PP
For example, if \fB-minneighbors\fP is two and there are two contiguous
black pixels in an otherwise white field, each of those pixels is isolated,
so \fBpbmclean\fP erases them - turns both white.
.PP
The default minimum 1 pixel - \fBpbmclean\fP flips only completely
isolated pixels.
.PP
(A \fB-minneighbors\fP value greater than 8 generates a completely
inverted image (but use \fBpnminvert\fP to do that) -- or a
completely white or completely black image with the \fB-black\fP or
\fB-white\fP option).
.PP
\fBpbmclean\fP 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).
.PP
\fBpbmclean\fP does not distinguish between foreground and background; by
default, it flips isolated pixels of either color.  But you can
specify \fB-black\fP or \fB-white\fP to have it flip only pixels of one
color.

.UN extended
.SS Extended Mode
.PP
In extended mode, \fBpbmclean\fP 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 \fB-minneighbors\fP value.  You specify the foreground color with
\fB-black\fP and \fB-white\fP (default is black).
.PP
For example, if \fB-minneighbors\fP is 2 and the foreground color is
black, and the image contains a straight line 4 pixels long, \fBpbmclean\fP
erases that -- turns all four pixels white.  \fBpbmclean\fP also erases
4 pixels in a square or L-shape.
.PP
The default \fB-minneighbors\fP is 4, so a blob must have at least 5
pixels to escape \fBpbmclean\fP's purge.
.PP
Extended mode was new in Netpbm 10.56 (September 2011).


.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see 
.UR index.html#commonoptions
 Common Options
.UE
\&), \fBpbmclean\fP recognizes the following
command line options:


.TP
\fB-black\fP

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

.TP
\fB-minneighbors=\fP\fIN\fP
This determines how many pixels must be in a cluster in order
for \fBpbmclean\fP to consider them legitimate and not clean them
out of the image.  See 
.UR #description
Description
.UE
\&.
.sp
Before December 2001, \fBpbmclean\fP accepted \fB-\fP\fIN\fP
instead of \fB-minneighbors\fP.  Before Netpbm 10.27 (March 2005),
\fB-minneighbors\fP was \fB-minneighbor\fP.

.TP
\fB-extended\fP
\fBpbmclean\fP uses extended, as opposed to basic, isolated pixel
detection.
.sp
This option was new in Netpbm 10.56 (September 2011).



.UN seealso
.SH SEE ALSO
.BR "pbm" (1)\c
\&

.UN author
.SH AUTHOR

Copyright (C) 1990 by Angus Duggan
Copyright (C) 1989 by Jef Poskanzer.
Copyright (C) 2001 by Michael Sternberg.
.PP
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.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pbmclean.html
.PP