Debian Codegraph @

upstream/debian-unstable/man1/pbmmask.1

raw
1 \
2 .\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
3 .\" Do not hand-hack it! If you have bug fixes or improvements, please find
4 .\" the corresponding HTML page on the Netpbm website, generate a patch
5 .\" against that, and send it to the Netpbm maintainer.
6 .TH "Pbmmask User Manual" 1 "28 September 2021" "netpbm documentation"
7
8 .SH NAME
9
10 pbmmask - create a mask bitmap from a regular bitmap
11
12 .UN synopsis
13 .SH SYNOPSIS
14
15 \fBpbmmask\fP
16 [\fB-expand\fP]
17 [\fIpbmfile\fP]
18
19 .UN description
20 .SH DESCRIPTION
21 .PP
22 This program is part of
23 .BR "Netpbm" (1)\c
24 \&.
25 .PP
26 \fBpbmmask\fP reads a PBM image as input and generates a
27 corresponding mask of the foreground areas as another PBM image.
28 .PP
29 This is probably obsoleted by \fBpambackground\fP.
30
31 .PP
32 The color to be interpreted as "background" is determined automatically.
33 Regardless of which color is background, the mask will be white where the
34 background is and black where the figure is.
35 .PP
36 This lets you do a masked paste like this, for objects with a black
37 background:
38
39 .nf
40 pbmmask obj > objmask
41 pnmpaste < dest -and objmask <x> <y> | pnmpaste -or obj <x> <y>
42
43 .fi
44
45 For objects with a white background, you can either invert them or
46 add a step:
47 .nf
48 pbmmask obj > objmask
49 pnminvert objmask | pnmpaste -and obj 0 0 > blackback
50 pnmpaste < dest -and objmask <x> <y> | pnmpaste -or blackback <x> <y>
51
52 .fi
53
54 Note that this three-step version works for objects with black backgrounds
55 too, if you don't care about the wasted time.
56 .PP
57 You can also use masks with grayscale and color images, using the
58 \fIpnmarith\fP tool. For instance:
59
60 .nf
61 ppmtopgm obj.ppm | pamditherbw -threshold | pbmmask > objmask.pbm
62 pnmarith -multiply dest.ppm objmask.pbm > t1.ppm
63 pnminvert objmask.pbm | pnmarith -multiply obj.ppm - > t2.ppm
64 pnmarith -add t1.ppm t2.ppm
65
66 .fi
67
68 An interesting variation on this is to pipe the mask through
69 \fIpnmsmooth\fP before using it. This makes the boundary between the
70 two images less sharp.
71
72 .UN options
73 .SH OPTIONS
74 .PP
75 In addition to the options common to all programs based on libnetpbm
76 (most notably \fB-quiet\fP, see
77 .UR index.html#commonoptions
78 Common Options
79 .UE
80 \&), \fBpbmmask\fP recognizes the following
81 command line option:
82
83
84 .TP
85 \fB-expand\fP
86 Expands the mask by one pixel out from the image. This is useful
87 if you want a little white border around your image. (A better
88 solution might be to turn the \fBpbmlife\fP program into a general
89 cellular automaton tool...)
90
91
92
93 .UN seealso
94 .SH SEE ALSO
95 .BR "pambackground" (1)\c
96 \&
97 .BR "ppmcolormask" (1)\c
98 \&,
99 .BR "pnmpaste" (1)\c
100 \&,
101 .BR "pnminvert" (1)\c
102 \&,
103 .BR "pnmarith" (1)\c
104 \&,
105 .BR "pnmsmooth" (1)\c
106 \&
107 .BR "pbm" (1)\c
108 \&,
109
110 .UN author
111 .SH AUTHOR
112
113 Copyright (C) 1988 by Jef Poskanzer.
114
115 .UN history
116 .SH HISTORY
117 .PP
118 \fBpbmmask\fP is one of the oldest programs in Netpbm. In September 2021,
119 the date on this manual was August 8, 1989 (being the date of the last
120 substantial update). We updated the page then just to add this historical
121 information and recommend \fBpambackground\fP.
122 .PP
123 It is likely that when Bryan wrote \fBpambackground\fP in 2006, he was
124 unaware \fBpbmmask\fP existed. Otherwise, he would presumably have
125 replaced \fBpbmmask\fP with a wrapper around \fBpambackground\fP.
126 .SH DOCUMENT SOURCE
127 This manual page was generated by the Netpbm tool 'makeman' from HTML
128 source. The master documentation is at
129 .IP
130 .B http://netpbm.sourceforge.net/doc/pbmmask.html
131 .PP