{
    "mode": "man",
    "parameter": "pgmnorm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/pgmnorm/1/json",
    "generated": "2026-06-02T19:35:02Z",
    "synopsis": "pnmnorm [-bpercent N | -bvalue N] [-wpercent N | -wvalue N] [-keephues] [-brightmax]\n[ppmfile]\nAll  options can be abbreviated to their shortest unique prefix.  You may use two hyphens in‐\nstead of one to designate an option.  You may use either white space or an  equals  sign  be‐\ntween an option name and its value.",
    "sections": {
        "NAME": {
            "content": "pnmnorm - normalize the contrast in a Netbpm image\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "pnmnorm [-bpercent N | -bvalue N] [-wpercent N | -wvalue N] [-keephues] [-brightmax]\n\n[ppmfile]\n\nAll  options can be abbreviated to their shortest unique prefix.  You may use two hyphens in‐\nstead of one to designate an option.  You may use either white space or an  equals  sign  be‐\ntween an option name and its value.\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Reads a PNM image (PBM, PGM, or PPM).  Normalizes the contrast by forcing the lightest pixels\nto white, the darkest pixels to black, and linearly rescaling the ones in between;  and  pro‐\nduces the same kind of file as output.  This is pretty useless for a PBM image.\n\nThe  program first determines a mapping of old brightness to new brightness.  For each possi‐\nble brightness of a pixel, the program determines a corresponding brightness for  the  output\nimage.\n\nThen  for  each pixel in the image, the program computes a color which has the desired output\nbrightness and puts that in the output.  With a color image, it is  not  always  possible  to\ncompute  such  a  color  and  retain  any semblance of the original hue, so the brightest and\ndimmest pixels may only approximate the desired brightness.\n\nNote that for a PPM image, this is different from separately normalizing the individual color\ncomponents.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "By  default, the darkest 2 percent of all pixels are mapped to black, and the lightest 1 per‐\ncent are mapped to white.  You can override these percentages  by  using  the  -bpercent  and",
            "subsections": [
                {
                    "name": "-wpercent -bvalue",
                    "content": "and -wvalue flags.  Appropriate numbers for the flags can be gotten from  the  ppmhist  tool.\nIf you just want to enhance the contrast, then choose values at elbows in the histogram; e.g.\nif value 29 represents 3% of the image but value 30 represents 20%, choose 30 for bvalue.  If\nyou  want  to lighten the image, then set bvalue to 0 and just fiddle with wvalue; similarly,\nto darken the image, set wvalue to maxval and play with bvalue.\n\nThe -keephues option says to keep each pixel the same hue as it is in the input; just  adjust\nits  intensity.  By default, pnmnorm normalizes contrast in each component independently (ex‐\ncept that the meaning of the -wpercent and -bpercent options are based on the overall  inten‐\nsities  of the colors, not each component taken separately).  So if you have a color which is\nintensely red but dimly green, pnmnorm would make the red more intense and the green less in‐\ntense, so you end up with a different hue than you started with.\n\nIf  you specify -keephues, pnmnorm would likely leave this pixel alone, since its overall in‐\ntensity is medium.\n"
                },
                {
                    "name": "-keephues",
                    "content": "one  of  its components is saturated.  Where that's the case, pnmnorm uses the maximum repre‐\nsentable intensity for the saturated component and the pixel ends up with less overall inten‐\nsity, and a different hue, than it is supposed to have.\n\nThis option is meaningless on grayscale images.\n\nBefore March 2002, there was no -keephues option.\n\nThe  -brightmax option says to use the intensity of the most intense RGB component of a pixel\nas the pixel's brightness.  By default, pnmnorm uses the  luminosity  of  the  color  as  its\nbrightness.\n\nThis option is meaningless on grayscale images.\n\nBefore March 2002, there was no -brightmax option.\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "ppmhist(1), pgmhist(1), pnmgamma(1), ppmbrighten(1), ppmdim(1), pnm(5)\n\n\n\n7 October 1993                                 pnmnorm(1)",
            "subsections": []
        }
    },
    "summary": "pnmnorm - normalize the contrast in a Netbpm image",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "and -wvalue flags. Appropriate numbers for the flags can be gotten from the ppmhist tool. 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 lighten 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. The -keephues option says to keep each pixel the same hue as it is in the input; just adjust its intensity. By default, pnmnorm normalizes contrast in each component independently (ex‐ cept that the meaning of the -wpercent and -bpercent options are based on the overall inten‐ sities 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 in‐ tense, 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 in‐ tensity is medium."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "one of its components is saturated. Where that's the case, pnmnorm uses the maximum repre‐ sentable 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. Before March 2002, there was no -keephues option. The -brightmax option says to use the intensity of the most intense RGB component of a pixel as the pixel's brightness. By default, pnmnorm uses the luminosity of the color as its brightness. This option is meaningless on grayscale images. Before March 2002, there was no -brightmax option."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "ppmhist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmhist/1/json"
        },
        {
            "name": "pgmhist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgmhist/1/json"
        },
        {
            "name": "pnmgamma",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnmgamma/1/json"
        },
        {
            "name": "ppmbrighten",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmbrighten/1/json"
        },
        {
            "name": "ppmdim",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmdim/1/json"
        },
        {
            "name": "pnm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "This command has been superseded by `pnmnorm`.",
        "examples": [
            {
                "description": "View documentation for the current command",
                "command": "tldr pnmnorm"
            }
        ]
    }
}