Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//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"></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"></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>

<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>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>