1Pambackground User Manual(0)                      Pambackground User Manual(0)
2
3
4

NAME

6       pambackground - create a mask of the background area of an image
7
8

SYNOPSIS

10       pambackground
11
12       [netpbmfile]
13
14       [-verbose=]
15
16       Minimum  unique  abbreviations  of options are acceptable.  You may use
17       double hyphens instead of single hyphen to denote options.  You may use
18       white space in place of the equals sign to separate an option name from
19       its value.
20
21
22

DESCRIPTION

24       This program is part of Netpbm(1).
25
26       pambackground reads a PNM or PAM image as input.  It generates as  out‐
27       put  a  PAM  image  that identifies the background area of the image (a
28       mask).
29
30       To identify the background, pambackground assumes the image is a  fore‐
31       ground  image, smaller than the total image size, placed over a single-
32       color background.  It assumes that foreground image is solid -- it does
33       not  have  holes  through which the background can be seen.  So in spe‐
34       cific, pambackground first identifies the background color, then  finds
35       all contiguous pixels of that color in regions touching any edge of the
36       image.  Think of it as starting at each of the four  edges  and  moving
37       inward  as  far  as possible until it hits pixels of another color (the
38       foreground image).
39
40       pambackground identifies the background color as follows: If any 3 cor‐
41       ners  of the image are the same color, that's the background color.  If
42       not, but 2 corners are the same color,  the  background  color  is  the
43       color  of a pair of identically colored corners in this priority order:
44       top, right, left, bottom.  If no two corners have the same  color,  the
45       background color is the color of the upper left corner.
46
47       In  a  typical  photograph,  the area that you would consider the back‐
48       ground is many shades of a color, so to pambackground  it  is  multiple
49       colors  and pambackground will not meaningfully identify the background
50       of your image.  To use pambackground in this case, you might  use  ppm‐
51       change  to  change all similar colors to a single one first.  For exam‐
52       ple, if the photograph is a building against a blue sky, where  nothing
53       remotely  sky-blue  appears in the building, you could use ppmchange to
54       change all pixels within 20% of 'SkyBlue' to SkyBlue, then run pamback‐
55       ground on it.
56
57       In  Release  10.37,  pambackground  does not really do what is promised
58       above.  It can't see places where the background appears in the  middle
59       of  a row (think of the sky between two buildings).  From Release 10.38
60       forward, it snakes through whatever passages it has to to find all  the
61       background.
62
63       The PAM that pambackground creates has a single plane, with a maxval of
64       1.  The sample value 1 means background; 0 means foreground.  There  is
65       no  tuple type.  Some older programs (but none that are part of Netpbm)
66       don't know what a PAM is and expect a mask to be in the form of  a  PGM
67       or  PBM  image.  To convert pambackground's output to PBM, use pamtopnm
68       -assume.  To convert to PGM, use pgmtopgm.
69
70       netpbmfile is the file specification of the input file, or -  to  indi‐
71       cate Standard Input.  The default is Standard Input.
72
73       A  common use for a background mask is with pamcomp.  You could replace
74       the entire background (or foreground)  of  your  image  with  something
75       else.
76
77       Another  common use is to make an image with the background transparent
78       (in some image format that has a concept of  transparency;  not  Netpbm
79       formats)  so  that  image  can  be  overlaid  onto another image later.
80       Netpbm's converters to image formats that have transparency (e.g.  PNG)
81       let  you  use  the  mask  that  pambackground generates to identify the
82       transparent areas for the output.
83
84       To simply make a mask of all the areas of a specified color,  use  ppm‐
85       colormask.   If  you  have  a unique background color (one that doesn't
86       occur in the foreground) and know what it is, this can create  a  back‐
87       ground  mask  in  cases that pambackground cannot: where there are see-
88       through holes in the foreground image.
89
90

OPTIONS

92       -verbose
93              Tell interesting facts about the process.
94
95
96
97

SEE ALSO

99       ppmcolormask(1), pamcomp(1), pamtopnm(1), pgmtopgm(1), pnm(1), pam(1),
100
101

HISTORY

103       pambackground was new in Netpbm 10.37 (December 2006).
104
105
106
107netpbm documentation           31 December 2006   Pambackground User Manual(0)
Impressum