Pnmnorm User Manual(0)                                  Pnmnorm User Manual(0)


       pnmnorm - normalize the contrast in a Netbpm image



       [-bpercent N | -bvalue N]

       [-wpercent N | -wvalue N]


       [-luminosity | -colorvalue | -saturation]


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


       This program is part of Netpbm(1).

       pnmnorm reads a PNM image (PBM, PGM, or PPM).  It normalizes  the  con-
       trast  by  forcing the brightest pixels to white, the darkest pixels to
       black, and linearly rescaling the ones in  between;  and  produces  the
       same kind of file as output.  This is pretty useless for a PBM image.

       The program first determines a mapping of old brightness to new bright-
       ness.  For each possible brightness of a pixel, the program  determines
       a corresponding brightness for the output image.

       Then  for  each  pixel in the image, the program computes a color which
       has the desired output brightness and puts that in the output.  With  a
       color  image,  it  is  not  always possible to compute such a color and
       retain any semblance of the original hue, so the brightest and  dimmest
       pixels may only approximate the desired brightness.

       For  a  PPM  image, you have a choice of three different ways to define

       ·      luminosity

       ·      color value

       ·      saturation

              In the case of saturation, ’brightness’ is pretty  much  a  mis-
              nomer,  but  you  can  use the brightness analogy to see what it
              does.  In the analogy, bright means  saturated  and  dark  means

       Note  that  all  of these are different from separately normalizing the
       individual color components.

       An alternative way to spread  out  the  brightnesses  in  an  image  is
       pnmhisteq.   pnmhisteq  stretches the brightest pixels to white and the
       darkest pixels to black, but rather than linearly adjusting the ones in
       between, it adjusts them so that there are an equal number of pixels of
       each brightness throughout the range.  This  gives  you  more  contrast
       than pnmnorm does, but can considerably change the picture in exchange.


       By default, the darkest 2 percent of all pixels are  mapped  to  black,
       and  the  brightest  1  percent  are mapped to white.  You can override
       these percentages by using the -bpercent and -wpercent options, or  you
       can  specify  the  exact pixel values to be mapped by using the -bvalue
       and -wvalue options.  You can get appropriate numbers for  the  options
       from  ppmhist.   If  you just want to enhance the contrast, then choose
       values at elbows in the histogram; e.g. if value 29  represents  3%  of
       the  image  but  value 30 represents 20%, choose 30 for bvalue.  If you
       want to brighten the image, then set bvalue to 0 and just  fiddle  with
       wvalue;  similarly,  to darken the image, set wvalue to maxval and play
       with bvalue.

       If you specify both -bvalue and -bpercent, pnmnorm uses  the  one  that
       produces  the minimal change.  The same goes for -wvalue and -wpercent.

       If you want to maximize the change instead of minimizing it, just  cas-
       cade  two runs of pnmnorm, specifying values for the first and percent-
       ages for the second.

       Before Netpbm 10.26 (December 2004), it was not valid to  specify  both
       -bvalue and -bpercent or -wvalue and -wpercent.

       The  -keephues  option says to keep each pixel the same hue as it is in
       the input; just adjust its brightness.  You  normally  want  this;  the
       only  reason  it  is not the default behavior is backward compatibility
       with a design mistake.

       By default, pnmnorm normalizes contrast in each component independently
       (except  that  the  meaning  of the -wpercent and -bpercent options are
       based on the overall brightnesses of the  colors,  not  each  component
       taken  separately).   So if you have a color which is intensely red but
       dimly green, pnmnorm would make the red more intense and the green less
       intense, so you end up with a different hue than you started with.

       If  you specify -keephues, pnmnorm would likely leave this pixel alone,
       since its overall brightness is medium.

       -keephues can cause clipping, because a certain color may  be  below  a
       target  intensity  while  one  of  its  components is saturated.  Where
       that’s the case, pnmnorm uses the maximum representable  intensity  for
       the  saturated component and the pixel ends up with less overall inten-
       sity, and a different hue, than it is supposed to have.

       This option is meaningless on grayscale images.

       When you dont specify -keephues,  the  -luminosity,  -colorvalue,  and
       -saturation options affect the transfer function (which is the same for
       all three RGB components), but are meaningless when it comes to  apply-
       ing  the  transfer function (since it is applied to each individual RGB

       Before Netpbm 9.25 (March 2002), there was no -keephues option.

       -luminosity, -colorvalue, and -saturation determine  what  property  of
       the  pixels  pnmnorm  normalizes.   I.e., what kind of brightness.  You
       cannot specify more than one of these.

       The -luminosity option says to use the luminosity (i.e. the ’Y’ in  the
       YUV or YCbCr color space) as the pixel’s brightness.  The luminosity is
       a measure of how bright a human eye would find the color,  taking  into
       account  the fact that the human eye is more sensitive to some RGB com-
       ponents than others.

       This option is default.

       This option is meaningless on grayscale images.

       Before Netpbm 10.28 (August 2005), there was no -luminosity option, but
       its meaning was still the default.

       Before Netpbm 10.28 (August 2005), there was no -colorvalue option.

       The -colorvalue option says to use the color value (i.e. the ’V’ in the
       HSV color space) as the pixel’s brightness.  The  color  value  is  the
       gamma-adjusted intensity of the most intense RGB component.

       This option is meaningless on grayscale images.

       Before Netpbm 10.28 (August 2005), there was no -colorvalue option.

       The  -saturation option says to use the saturation (i.e. the ’S’ in the
       HSV color space) as the pixel’s  brightness.   The  saturation  is  the
       ratio of the intensity of the most intense RGB component to the differ-
       ence between the intensities of the most and least intense  RGB  compo-
       nent (all intensities gamma-adjusted).

       In  this  case,  ’brightness’  is  more  of  a  metaphor than anything.
       ’bright’ means saturated and ’dark’ means unsaturated.

       This option is meaningless on grayscale images.

       Before Netpbm 10.28 (August 2005), there was no -colorvalue option.


       pnmhisteq(1),  ppmhist(1),  pgmhist(1),  pnmgamma(1),   ppmbrighten(1),
       ppmdim(1), pnm(1)

netpbm documentation              17 May 2005           Pnmnorm User Manual(0)

Man(1) output converted with man2html