diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-11-09 18:03:04 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2014-11-09 18:03:04 +0000 |
commit | aeaa600e1893e0456ad06a6717b5201267ab10a4 (patch) | |
tree | f2b4ba10c3db829faf26b92950898db344952f78 /pambackground.html | |
parent | 572a7ee63cbf8174d9f73c102f9afe8ade54fb9a (diff) | |
download | netpbm-mirror-aeaa600e1893e0456ad06a6717b5201267ab10a4.tar.gz netpbm-mirror-aeaa600e1893e0456ad06a6717b5201267ab10a4.tar.xz netpbm-mirror-aeaa600e1893e0456ad06a6717b5201267ab10a4.zip |
miscellaneous update
git-svn-id: http://svn.code.sf.net/p/netpbm/code/userguide@2305 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'pambackground.html')
-rw-r--r-- | pambackground.html | 78 |
1 files changed, 54 insertions, 24 deletions
diff --git a/pambackground.html b/pambackground.html index be090d50..70b9a470 100644 --- a/pambackground.html +++ b/pambackground.html @@ -2,7 +2,7 @@ <HTML><HEAD><TITLE>Pambackground User Manual</TITLE></HEAD> <BODY> <H1>pambackground</H1> -Updated: 31 December 2006 +Updated: 09 November 2014 <BR> <A HREF="#index">Table Of Contents</A> @@ -28,19 +28,18 @@ name from its value. <p>This program is part of <a href="index.html">Netpbm</a>. -<p><b>pambackground</b> reads a PNM or PAM image as input. -It generates as output a PAM image that identifies the background area -of the image (a mask). +<p><b>pambackground</b> reads a PNM or PAM image as input. It generates as +output a PAM image that identifies the background area of the image (a mask). -<p>To identify the background, <b>pambackground</b> assumes the image -is a foreground image, smaller than the total image size, placed over -a single-color background. It assumes that foreground image is solid --- it does not have holes through which the background can be seen. -So in specific, <b>pambackground</b> first identifies the background -color, then finds all contiguous pixels of that color in regions -touching any edge of the image. Think of it as starting at each of -the four edges and moving inward as far as possible until it hits -pixels of another color (the foreground image). +<p>To identify the background, <b>pambackground</b> assumes the image is a +foreground image, smaller than the total image size, placed over a +single-color background. It assumes that foreground image is solid -- it does +not have holes through which the background can be seen. So in +specific, <b>pambackground</b> first identifies the background color, then +finds all contiguous pixels of that color in regions touching any edge of the +image. Think of it as starting at each of the four edges and moving inward +and spreading out as far as possible until it hits pixels of another color +(the foreground image). <p><b>pambackground</b> identifies the background color as follows: If any 3 corners of the image are the same color, that's the background @@ -60,11 +59,19 @@ building, you could use <b>ppmchange</b> to change all pixels within 20% of "SkyBlue" to SkyBlue, then run <b>pambackground</b> on it. -<p>In Release 10.37, <b>pambackground</b> does not really -do what is promised above. It can't see places where the background -appears in the middle of a row (think of the sky between two buildings). -From Release 10.38 forward, it snakes through whatever passages it has to -to find all the background. +<p>A more convenient means of dealing with a multi-shade background is +to use <b>pnmquant</b> to produce a version of the image with a very small +number of colors. The background would likely then be all one color. + +<p>If the <b>pnmquant</b> and <b>ppmchange</b> methods above do not +adequately distinguish foreground colors from background colors, you can +try a more elaborate method using <b>pnmremap</b>. +If you can manually create a palette with +one color to which all the background pixels are similar, and other colors +to which the foreground pixels are similar, you can use it as input to +<b>pnmremap</b> to create a smarter version of what you get with the +<b>pnmquant</b> or <b>ppmchange</b> methods, so that <b>pambackground</b> is +more likely to separate background from foreground as your eye does. <p>The PAM that <b>pambackground</b> creates has a single plane, with a maxval of 1. The sample value 1 means background; 0 means @@ -81,12 +88,12 @@ convert to PGM, use <b>pgmtopgm</b>. could replace the entire background (or foreground) of your image with something else. -<p>Another common use is to make an image with the background -transparent (in some image format that has a concept of transparency; -not Netpbm formats) so that image can be overlaid onto another image -later. Netpbm's converters to image formats that have transparency -(e.g. PNG) let you use the mask that <b>pambackground</b> generates -to identify the transparent areas for the output. +<p>Another common use is to make an image with the background transparent (in +some image format that has a concept of transparency) so that image can be +overlaid onto another image later. Netpbm's converters to image formats that +have transparency (e.g. PNG) let you use the mask that <b>pambackground</b> +generates to identify the transparent areas for the output. You can create +a PAM image with transparency with <b>pamstack</b>. <p>To simply make a mask of all the areas of a specified color, use <b>ppmcolormask</b>. If you have a unique background color (one that @@ -94,6 +101,7 @@ doesn't occur in the foreground) and know what it is, this can create a background mask in cases that <b>pambackground</b> cannot: where there are see-through holes in the foreground image. + <H2 id="options">OPTIONS</H2> <dl> @@ -104,12 +112,33 @@ are see-through holes in the foreground image. </dl> +<h2 id="examples">EXAMPLES</h2> + +<p> +<pre> +<kbd> + $ pambackground test.ppm | pnminvert >/tmp/bgmask.pgm + $ pamcomp -alpha=bgmask.pgm test.ppm wallpaper.ppm >output.ppm +</kbd> +</pre> +<p> +<pre> +<kbd> + $ pnmquant 5 test.pgm | pambackground test.ppm >/tmp/bgmask.pam +</kbd> +</pre> + + <H2 id="seealso">SEE ALSO</H2> <B><A HREF="ppmcolormask.html">ppmcolormask</A></B>, <B><A HREF="pamcomp.html">pamcomp</A></B>, +<B><A HREF="ppmchange.html">ppmchange</A></B>, +<B><A HREF="pnmquant.html">pnmquant</A></B>, +<B><A HREF="pnmremap.html">pnmremap</A></B>, <B><A HREF="pamtopnm.html">pamtopnm</A></B>, <B><A HREF="pgmtopgm.html">pgmtopgm</A></B>, +<B><A HREF="pamstack.html">pamstack</A></B>, <B><A HREF="pnm.html">pnm</A></B>, <B><A HREF="pam.html">pam</A></B>, @@ -123,6 +152,7 @@ are see-through holes in the foreground image. <LI><A HREF="#synopsis">SYNOPSIS</A> <LI><A HREF="#description">DESCRIPTION</A> <LI><A HREF="#options">OPTIONS</A> +<LI><A HREF="#examples">OPTIONS</A> <LI><A HREF="#seealso">SEE ALSO</A> </UL> </BODY> |