1Pbmmask User Manual(0) Pbmmask User Manual(0)
2
3
4
6 pbmmask - create a mask bitmap from a regular bitmap
7
8
10 pbmmask [-expand] [pbmfile]
11
12
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 The color to be interpreted as "background" is determined automati‐
20 cally. Regardless of which color is background, the mask will be white
21 where the background is and black where the figure is.
22
23 This lets you do a masked paste like this, for objects with a black
24 background:
25
26 pbmmask obj > objmask
27 pnmpaste < dest -and objmask <x> <y> | pnmpaste -or obj <x> <y>
28
29 For objects with a white background, you can either invert them or add
30 a step:
31 pbmmask obj > objmask
32 pnminvert objmask | pnmpaste -and obj 0 0 > blackback
33 pnmpaste < dest -and objmask <x> <y> | pnmpaste -or blackback <x> <y>
34
35 Note that this three-step version works for objects with black back‐
36 grounds too, if you don't care about the wasted time.
37
38 You can also use masks with grayscale and color images, using the
39 pnmarith tool. For instance:
40
41 ppmtopgm obj.ppm | pamditherbw -threshold | pbmmask > objmask.pbm
42 pnmarith -multiply dest.ppm objmask.pbm > t1.ppm
43 pnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm
44 pnmarith -add t1.ppm t2.ppm
45
46 An interesting variation on this is to pipe the mask through pnmsmooth
47 before using it. This makes the boundary between the two images less
48 sharp.
49
50
52 In addition to the options common to all programs based on libnetpbm
53 (most notably -quiet, see
54 Common Options ⟨index.html#commonoptions⟩ ), pbmmask recognizes the
55 following command line option:
56
57
58
59 -expand
60 Expands the mask by one pixel out from the image. This is use‐
61 ful if you want a little white border around your image. (A
62 better solution might be to turn the pbmlife program into a gen‐
63 eral cellular automaton tool...)
64
65
66
67
69 ppmcolormask(1), pnmpaste(1), pnminvert(1), pnmarith(1), pnmsmooth(1)
70 pbm(1),
71
72
74 Copyright (C) 1988 by Jef Poskanzer.
75
77 This manual page was generated by the Netpbm tool 'makeman' from HTML
78 source. The master documentation is at
79
80 http://netpbm.sourceforge.net/doc/pbmmask.html
81
82netpbm documentation 08 August 1989 Pbmmask User Manual(0)