diff options
Diffstat (limited to 'upstream/opensuse-tumbleweed/man1/pambackground.1')
-rw-r--r-- | upstream/opensuse-tumbleweed/man1/pambackground.1 | 191 |
1 files changed, 191 insertions, 0 deletions
diff --git a/upstream/opensuse-tumbleweed/man1/pambackground.1 b/upstream/opensuse-tumbleweed/man1/pambackground.1 new file mode 100644 index 00000000..0690bf6c --- /dev/null +++ b/upstream/opensuse-tumbleweed/man1/pambackground.1 @@ -0,0 +1,191 @@ +\ +.\" 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 "Pambackground User Manual" 0 "24 November 2014" "netpbm documentation" + +.SH NAME +pambackground - create a mask of the background area of an image + +.UN synopsis +.SH SYNOPSIS + +\fBpambackground\fP + +[\fInetpbmfile\fP] + +[\fB-verbose\fP] +.PP +Minimum unique abbreviations of options are acceptable. You may +use double hyphens instead of single hyphen to denote options. You +may use white space in place of the equals sign to separate an option +name from its value. + + +.UN description +.SH DESCRIPTION +.PP +This program is part of +.BR "Netpbm" (1)\c +\&. +.PP +\fBpambackground\fP 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). +.PP +To identify the background, \fBpambackground\fP 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, \fBpambackground\fP 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). +.PP +\fBpambackground\fP identifies the background color as follows: +If any 3 corners of the image are the same color, that's the background +color. If not, but 2 corners are the same color, the background color +is the color of a pair of identically colored corners in this priority +order: top, right, left, bottom. If no two corners have the same color, +the background color is the color of the upper left corner. +.PP +In a typical photograph, the area that you would consider the +background is many shades of a color, so to \fBpambackground\fP it is +multiple colors and \fBpambackground\fP will not meaningfully +identify the background of your image. To use \fBpambackground\fP in +this case, you might use \fBppmchange\fP to change all similar colors +to a single one first. For example, if the photograph is a building +against a blue sky, where nothing remotely sky-blue appears in the +building, you could use \fBppmchange\fP to change all pixels within +20% of "SkyBlue" to SkyBlue, then run \fBpambackground\fP +on it. +.PP +You might even extract the argument for \fBppmchange\fP from the image in +question, using \fBpamgetcolor\fP. In the foregoing example, we knew the +background was approximately SkyBlue, but if we didn't we could just get the +color of the top left pixel, in a form suitable for the color arguments +of \fBppmchange\fP like this: + +.nf +\f(CW + $ color=$(pamgetcolor 0,0 -infile=/tmp/bodyskl|cut --fields=2 -delim=' ') +\fP + +.fi +.PP +A more convenient means of dealing with a multi-shade background is +to use \fBpnmquant\fP to produce a version of the image with a very small +number of colors. The background would likely then be all one color. +.PP +If the \fBpnmquant\fP and \fBppmchange\fP methods above do not adequately +distinguish foreground colors from background colors, you can try a more +elaborate method using \fBpnmremap\fP. 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 +\fBpnmremap\fP to create a smarter version of what you get with the +\fBpnmquant\fP or \fBppmchange\fP methods, so that \fBpambackground\fP is +more likely to separate background from foreground as your eye does. +.PP +The PAM that \fBpambackground\fP creates has a single plane, with a maxval +of 1. The sample value 1 means background; 0 means foreground. There is no +tuple type. Some older programs (but none that are part of Netpbm) don't know +what a PAM is and expect a mask to be in the form of a PGM or PBM image. To +convert \fBpambackground\fP's output to PBM, use \fBpamtopnm -assume\fP. To +convert to PGM, use \fBpgmtopgm\fP. +.PP +\fInetpbmfile\fP is the file specification of the input file, or +\fB-\fP to indicate Standard Input. The default is Standard Input. +.PP +A common use for a background mask is with \fBpamcomp\fP. You +could replace the entire background (or foreground) of your +image with something else. +.PP +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 \fBpambackground\fP +generates to identify the transparent areas for the output. You can create +a PAM image with transparency with \fBpamstack\fP. +.PP +To simply make a mask of all the areas of a specified color, use +\fBppmcolormask\fP. If you have a unique background color (one that +doesn't occur in the foreground) and know what it is, this can create +a background mask in cases that \fBpambackground\fP cannot: where there +are see-through holes in the foreground image. + + +.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 +\&), \fBpambackground\fP recognizes the following +command line option: + + + +.TP +\fB-verbose\fP +Tell interesting facts about the process. + + + +.UN examples +.SH EXAMPLES + +.nf +\f(CW + $ pambackground test.ppm | pnminvert >/tmp/bgmask.pgm + $ pamcomp -alpha=bgmask.pgm test.ppm wallpaper.ppm >output.ppm +\fP + +.fi +.nf +\f(CW + $ pnmquant 5 test.pgm | pambackground test.ppm >/tmp/bgmask.pam +\fP + +.fi + + +.UN seealso +.SH SEE ALSO +.BR "ppmcolormask" (1)\c +\&, +.BR "pamcomp" (1)\c +\&, +.BR "ppmchange" (1)\c +\&, +.BR "pnmquant" (1)\c +\&, +.BR "pnmremap" (1)\c +\&, +.BR "pamtopnm" (1)\c +\&, +.BR "pgmtopgm" (1)\c +\&, +.BR "pamstack" (1)\c +\&, +.BR "pamgetcolor" (1)\c +\&, +.BR "pbmmaskd" (1)\c +\&, +.BR "pnm" (5)\c +\&, +.BR "pam" (5)\c +\&, + +.UN history +.SH HISTORY +.PP +\fBpambackground\fP was new in Netpbm 10.37 (December 2006). +.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/pambackground.html +.PP
\ No newline at end of file |