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

NAME

6       pamfunc - Apply a simple monadic arithmetic function to a Netpbm image
7
8

SYNOPSIS

10       pamfunc  {  -multiplier=realnum  |  -divisor=realnum | -adder=integer |
11       -subtractor=integer | -min=wholenum  |  -max=wholenum  -andmask=hexmask
12       -ormask=hexmask       -xormask=hexmask       -not      -shiftleft=count
13       -shiftright=count } [filespec]
14
15       All options can be abbreviated to their shortest  unique  prefix.   You
16       may  use  two  hyphens instead of one.  You may separate an option name
17       and its value with white space instead of an equals sign.
18
19

DESCRIPTION

21       This program is part of Netpbm(1).
22
23       pamfunc reads a Netpbm image as input and produces a  Netpbm  image  as
24       output,  with  the  same  format,  maxval, and dimensions as the input.
25       pamfunc applies a simple transfer function to each sample in the  input
26       to generate the corresponding sample in the output.  The options deter‐
27       mine what function.
28
29       pamarith is the same thing, except only  for  PNM  images,  for  binary
30       functions  --  it takes two PNM images as input and applies a specified
31       simple arithmetic function (e.g. addition) on pairs of samples from the
32       two to produce the single output image.
33
34
35

OPTIONS

37       -multiplier=realnum
38
39              This option makes the transfer function that of multiplying by
40                   realnum.  realnum must be nonnegative.  If the result
41                   is greater than the image maxval, it is clipped to the max‐
42              val.
43
44              Where the input is a PGM or PPM image, this has the effect of
45                   dimming or brightening it.  For a different kind of bright‐
46              ening,
47                   see ppmbrighten(1)and ppmflash(1)
48
49              Also, see ppmdim(1),whichdoesthe
50                   same thing as pamfunc -multiplier on a PPM image with a
51                   multiplier between 0 and 1,
52                   except it uses integer arithmetic, so it may be faster.
53
54              And ppmfade(1)cangenerateawhole
55                   sequence  of  images  of  brightness  declining to black or
56              increasing to
57                   white, if that's what you want.
58
59
60       -divisor=realnum
61
62              This option makes the transfer function that of dividing by
63                   realnum.  realnum must be nonnegative.  If the result
64                   is greater than the image maxval, it is clipped to the max‐
65              val.
66
67              This is the same function as you would get with -multiplier,
68                   specifying the multiplicative inverse of realnum.
69
70
71       -adder=integer
72
73              This option makes the transfer function that of adding
74                   wholenum.  If the result is greater than the image maxval,
75                   it  is  clipped to the maxval.  If it is less than zero, it
76              is
77                   clipped to zero.
78
79              Note that in mathematics, this entity is called an 'addend,'
80                   and an 'adder' is a snake.  We use 'adder' because
81                   it makes more sense.
82
83
84       -subtractor=integer
85
86              This option makes the transfer function that of subtracting
87                   wholenum.  If the result is greater than the image maxval,
88                   it is clipped to the maxval.  If it is less than  zero,  it
89              is
90                   clipped to zero.
91
92              Note that in mathematics, this entity is called a
93                   'subtrahend' rather than a 'subtractor.'  We
94                   use 'subtractor' because it makes more sense.
95
96              This is the same function as you would get with -adder,
97                   specifying the negative of integer.
98
99
100       -min=wholenum
101
102              This option makes the transfer function that of taking the
103                   maximum of the argument and wholenum.  I.e the minimum
104                   value in the output will be wholenum.
105
106                   If  wholenum is greater than the maxval, though, every sam‐
107              ple
108                   in the output will be maxval.
109
110
111       -max=wholenum
112
113              This option makes the transfer function that of taking the
114                   minimum of the argument and wholenum.  I.e the maximum
115                   value in the output will be wholenum.
116
117                   If wholenum is greater than the maxval, the function is
118                   idempotent -- the output is identical to the input.
119
120
121       -andmask=hexmask
122
123              This option makes the transfer function that of bitwise anding
124                   with hexmask.
125
126              hexmask is in hexadecimal.  Example: 0f
127
128              See section Maxval ⟨#maxval⟩  for the special
129                   meaning of maxval with respect  to  bit  string  operations
130              such as
131                   this.
132
133              This option was new in Netpbm 10.40 (September 2007).
134
135
136       -ormask=hexmask
137
138              This option makes the transfer function that of bitwise
139                   inclusive oring with hexmask.
140
141              This is analogous to -andmask.
142
143              This option was new in Netpbm 10.40 (September 2007).
144
145
146       -xormask=hexmask
147
148              This option makes the transfer function that of bitwise
149                   exclusive oring with hexmask.
150
151              This is analogous to -andmask.
152
153              This option was new in Netpbm 10.40 (September 2007).
154
155
156       -not
157
158              This option makes the transfer function that of bitwise logical
159                   inversion (e.g. sample value 0xAA becomes 0x55).
160
161              See section Maxval ⟨#maxval⟩  for the special
162                   meaning  of  maxval  with  respect to bit string operations
163              such as
164                   this.
165
166              pnminvert does the same thing for a bilevel visual image
167                   which has maxval 1 or is of PBM type.
168
169              This option was new in Netpbm 10.40 (September 2007).
170
171
172       -shiftleft=count
173
174              This option makes the transfer function that of bitwise shifting
175                   left by count bits.
176
177              See section Maxval ⟨#maxval⟩  for the special
178                   meaning of maxval with respect  to  bit  string  operations
179              such as
180                   this.
181
182              This option was new in Netpbm 10.40 (September 2007).
183
184
185       -shiftright=count
186
187              This option makes the transfer function that of bitwise shifting
188                   right by count bits.
189
190              This is analogous to -shiftleft.
191
192              This option was new in Netpbm 10.40 (September 2007).
193
194
195
196

MAXVAL

198       For  the arithmetic functions, the maxval has no meaning.  The function
199       applies to the sample value as an integer.   (Note  that  this  differs
200       from  the  usual interpretation of PAM samples as being a fraction of a
201       maxval, but does produce more intuitive result: 2 times 5 is 10.
202
203       But with the bit string operations, the maxval has a  special  meaning.
204       The  functions  in  question  are:  -andmask,  -ormask, -xormask, -not,
205       -shiftleft, and -shiftright.
206
207       With these, each sample value the input image, and in the output image,
208       represents  a  bit string, not a number.  The maxval tells how wide the
209       bit string is.  The maxval must be a full binary count (a power of  two
210       minus  one,  such as 0xff) and the number of ones in it is the width of
211       the bit string.
212
213       For a masking function, the mask value you specify must not  have  more
214       significant bits than the width indicated by the maxval.
215
216       For  a  shifting  operation,  the  shift  count you specify must not be
217       greater than the width indicated by the maxval.
218
219       The maxval of the output image is the same as that of the input image.
220
221
222

SEE ALSO

224       ppmdim(1),  ppmbrighten(1),  pamdepth(1),  pamarith(1),  pamsummcol(1),
225       pamsumm(1), ppmfade(1), pnminvert(1), pam(1), pnm(1),
226
227

HISTORY

229       This program was added to Netpbm in Release 10.3 (June 2002).
230
231
232
233netpbm documentation               July 2007            Pamfunc User Manual(0)
Impressum