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 -expand
53 Expands the mask by one pixel out from the image. This is use‐
54 ful if you want a little white border around your image. (A
55 better solution might be to turn the pbmlife program into a gen‐
56 eral cellular automaton tool...)
57
58
59
60
62 ppmcolormask(1), pnmpaste(1), pnminvert(1), pnmarith(1), pnmsmooth(1)
63 pbm(1),
64
65
67 Copyright (C) 1988 by Jef Poskanzer.
68
70 This manual page was generated by the Netpbm tool 'makeman' from HTML
71 source. The master documentation is at
72
73 http://netpbm.sourceforge.net/doc/pbmmask.html
74
75netpbm documentation 08 August 1989 Pbmmask User Manual(0)