\ .\" 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