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

NAME

6       pbmmask - create a mask bitmap from a regular bitmap
7
8

SYNOPSIS

10       pbmmask [-expand] [pbmfile]
11
12

DESCRIPTION

14       This program is part of Netpbm(1).
15
16       pbmmask  reads  a PBM image as input and generates a corresponding mask
17       of the foreground areas as another PBM image.
18
19       This is probably obsoleted by pambackground.
20
21
22       The color to be interpreted as  "background"  is  determined  automati‐
23       cally.  Regardless of which color is background, the mask will be white
24       where the background is and black where the figure is.
25
26       This lets you do a masked paste like this, for  objects  with  a  black
27       background:
28
29           pbmmask obj > objmask
30           pnmpaste < dest -and objmask <x> <y> | pnmpaste -or obj <x> <y>
31
32
33       For  objects with a white background, you can either invert them or add
34       a step:
35           pbmmask obj > objmask
36           pnminvert objmask | pnmpaste -and obj 0 0 > blackback
37           pnmpaste < dest -and objmask <x> <y> | pnmpaste -or blackback <x> <y>
38
39
40       Note that this three-step version works for objects  with  black  back‐
41       grounds too, if you don't care about the wasted time.
42
43       You  can  also use masks with grayscale and color images, using the pn‐
44       marith tool.  For instance:
45
46           ppmtopgm obj.ppm | pamditherbw -threshold | pbmmask > objmask.pbm
47           pnmarith -multiply dest.ppm objmask.pbm > t1.ppm
48           pnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm
49           pnmarith -add t1.ppm t2.ppm
50
51
52       An interesting variation on this is to pipe the mask through  pnmsmooth
53       before  using  it.  This makes the boundary between the two images less
54       sharp.
55
56

OPTIONS

58       In addition to the options common to all programs  based  on  libnetpbm
59       (most notably -quiet, see
60        Common  Options  ⟨index.html#commonoptions⟩  ), pbmmask recognizes the
61       following command line option:
62
63
64
65       -expand
66              Expands the mask by one pixel out from the image.  This is  use‐
67              ful  if  you  want  a little white border around your image.  (A
68              better solution might be to turn the pbmlife program into a gen‐
69              eral cellular automaton tool...)
70
71
72
73

SEE ALSO

75       pambackground(1)   ppmcolormask(1),   pnmpaste(1),   pnminvert(1),  pn‐
76       marith(1), pnmsmooth(1) pbm(1),
77
78

AUTHOR

80       Copyright (C) 1988 by Jef Poskanzer.
81
82

HISTORY

84       pbmmask is one of the oldest programs in Netpbm.  In September 2021,
85         the date on this manual was August 8, 1989 (being  the  date  of  the
86       last
87         substantial update).  We updated the page  then just to add this his‐
88       torical
89         information and recommend pambackground.
90
91       It is likely that when Bryan wrote pambackground in 2006, he was
92         unaware pbmmask existed.  Otherwise, he would presumably have
93         replaced pbmmask with a wrapper around pambackground.
94

DOCUMENT SOURCE

96       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
97       source.  The master documentation is at
98
99              http://netpbm.sourceforge.net/doc/pbmmask.html
100
101netpbm documentation           28 September 2021        Pbmmask User Manual(0)
Impressum