# pamfunc

Updated: June 2002
Index

## NAME

pamfunc: Apply simple arithmetic functions to a Netpbm image

## SYNOPSIS

pamfunc { -multiplier=realnum | -divisor=realnum | -adder=integer | -subtractor=integer | -min=wholenum | -max=wholenum } [filespec]

All options can be abbreviated to their shortest unique prefix. You may use two hyphens instead of one. You may separate an option name and its value with white space instead of an equals sign.

## DESCRIPTION

Reads a Netpbm image as input. Produces a Netpbm image as output, with the same format, maxval, and dimensions as the input. pamfunc applies a simple transfer function to each sample in the input to generate the corresponding sample in the output. The options determine what function.

pnmarith is the same thing, except only for PNM images, for binary functions -- it takes two PNM images as input and applies a specified simple arithmetic function (e.g. addition) on pairs of samples from the two to produce the single output image.

## OPTIONS

-multiplier=realnum

  This option makes the transfer function that of multiplying by realnum. realnum must be nonnegative. If the result is greater than the image maxval, it is clipped to the maxval.

  Where the input is a PGM or PPM image, this has the effect of dimming or brightening it. For a different kind of brightening, see ppmbrighten and ppmflash

  Also, see ppmdim, which does the same thing as pamfunc -multiplier on a PPM image with a multiplier between 0 and 1, except it uses integer arithmetic, so it may be faster.

  And ppmfade can generate a whole sequence of images of brightness declining to black or increasing to white, if that's what you want.

-divisor=realnum

  This option makes the transfer function that of dividing by realnum. realnum must be nonnegative. If the result is greater than the image maxval, it is clipped to the maxval.

  This is the same function as you would get with -multiplier, specifying the multiplicative inverse of realnum.

-adder=integer

  This option makes the transfer function that of adding wholenum. If the result is greater than the image maxval, it is clipped to the maxval. If it is less than zero, it is clipped to zero.

-subtractor=integer

  This option makes the transfer function that of subtracting wholenum. If the result is greater than the image maxval, it is clipped to the maxval. If it is less than zero, it is clipped to zero.

  This is the same function as you would get with -multiplier, specifying the negative of integer.

-min=wholenum

  This option makes the transfer function that of taking the maximum of the argument and wholenum. I.e the minimum value in the output will be wholenum. If wholenum is greater than the maxval, though, every sample in the output will be maxval.

-max=wholenum

  This option makes the transfer function that of taking the minimum of the argument and wholenum. I.e the maximum value in the output will be wholenum. If wholenum is greater than the maxval, the function is idempotent -- the output is identical to the input.

## SEE ALSO

ppmdim, ppmbrighten, pnmdepth, pnmarith, ppmfade, pbm, pbm,

## HISTORY

This program was added to Netpbm in Release 10.3 (June 2002).

## Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
SEE ALSO
HISTORY