{
    "content": [
        {
            "type": "text",
            "text": "# pnmgamma (man)\n\n## NAME\n\npnmgamma - perform gamma correction on a portable anymap\n\n## SYNOPSIS\n\npnmgamma [-ungamma] [-cieramp|-srgbramp] [value [pnmfile]]\npnmgamma [-ungamma] [-cieramp|-srgbramp] redgamma greengamma bluegamma [pnmfile]\n\n## DESCRIPTION\n\nPerforms gamma correction on pseudo-PNM images.\n\n## TLDR\n\n> Perform gamma correction on PNM images.\n\n- Convert the image from BT.709 luminance to radiance or sRGB luminance:\n  `pnmgamma -{{bt709tolinear|bt709tosrgb}} {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n- Convert the image from radiance or sRGB luminance to BT.709 luminance:\n  `pnmgamma -{{lineartobt709|srgbtobt709}} {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n- Specify the gamma value used for the gamma transfer function:\n  `pnmgamma {{-ga|-gamma}} {{value}} {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n- Specify the gamma value used for the gamma transfer function per color component:\n  `pnmgamma {{-rg|-rgamma}} {{value}} {{-gg|-ggamma}} {{value}} {{-bg|-bgamma}} {{value}} {{path/to/image.pnm}} > {{path/to/output.pnm}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PARAMETERS**\n- **OPTIONS** (3 subsections)\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pnmgamma",
        "section": "",
        "mode": "man",
        "summary": "pnmgamma - perform gamma correction on a portable anymap",
        "synopsis": "pnmgamma [-ungamma] [-cieramp|-srgbramp] [value [pnmfile]]\npnmgamma [-ungamma] [-cieramp|-srgbramp] redgamma greengamma bluegamma [pnmfile]",
        "tldr_summary": "Perform gamma correction on PNM images.",
        "tldr_examples": [
            {
                "description": "Convert the image from BT.709 luminance to radiance or sRGB luminance",
                "command": "pnmgamma -{{bt709tolinear|bt709tosrgb}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Convert the image from radiance or sRGB luminance to BT.709 luminance",
                "command": "pnmgamma -{{lineartobt709|srgbtobt709}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Specify the gamma value used for the gamma transfer function",
                "command": "pnmgamma {{-ga|-gamma}} {{value}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            },
            {
                "description": "Specify the gamma value used for the gamma transfer function per color component",
                "command": "pnmgamma {{-rg|-rgamma}} {{value}} {{-gg|-ggamma}} {{value}} {{-bg|-bgamma}} {{value}} {{path/to/image.pnm}} > {{path/to/output.pnm}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Apply the inverse of the specified transfer function (i.e. go from gamma-corrected nonlinear intensities to linear intensities)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Use the CIE Rec. 709 gamma transfer function. Note that it is true CIE Rec. 709 only if you use the default gamma value (i.e. don't specify any gamma parameters). This transfer function is a power function modified with a linear ramp near black. If you specify neither -cieramp nor -srgbramp, the transfer function defaults to a simple power function."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Use the Internation Electrotechnical Commission (IEC) SRGB gamma transfer function (as specified in the standard IEC 61966-2-1). Note that it is true SRGB only if you use the default gamma value (i.e. don't specify any gamma parameters). This transfer function is like the one selected by -cieramp, but with different constants in it. Note that SRGB is often spelled \"sRGB\". In this document, we use standard English ty- pography, though, which doesn't allow for that kind of capitalization. If you specify neither -cieramp nor -srgbramp, the transfer function defaults to a simple power function. WHAT IS GAMMA? A good explanation of gamma is in Charles Poynton's GammaFAQ at <http://www.poyn- ton.com/notes/colourandgamma/ColorFAQ.html> and ColorFAQ at <http://www.poyn- ton.com/notes/colourandgamma/GammaFAQ.html> In brief: The simplest way to code an image is by using sample values that are directly pro- portional to the intensity of the color components. But that wastes the sample space because the human eye can't discern differences between low-intensity colors as well as it can be- tween high-intensity colors. So instead, we pass the light intensity values through a trans- fer function that makes it so that changing a sample value by 1 causes the same level of per- ceived color change anywhere in the sample range. We store those resulting values in the im- age file. That transfer function is called the gamma transfer function and the transforma- tion is called gamma correcting. Virtually all image formats, either specified or de facto, use gamma-corrected values for their sample values. What's really nice about gamma is that by coincidence, the inverse function that you have to do to convert the gamma-corrected values back to real light intensities is done automatically by CRTs. You just apply a voltage to the CRT's electron gun that is proportional to the gamma-corrected sample value, and the intensity of light that comes out of the screen is close to the intensity value you had before you applied the gamma transfer function! And when you consider that computer video devices usually want you to store in video memory a value proportional to the signal voltage you want to go to the monitor, which the monitor turns into a proportional drive voltage on the electron gun, it is really convenient to work with gamma-corrected sample values."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "pnm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-ungamma",
                        "lines": 3
                    },
                    {
                        "name": "-cieramp",
                        "lines": 7
                    },
                    {
                        "name": "-srgbramp",
                        "lines": 39
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pnmgamma - perform gamma correction on a portable anymap\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pnmgamma [-ungamma] [-cieramp|-srgbramp] [value [pnmfile]]\npnmgamma [-ungamma] [-cieramp|-srgbramp] redgamma greengamma bluegamma [pnmfile]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Performs gamma correction on pseudo-PNM images.\n\nThe  PPM  format specification specify that certain sample values in a file represent certain\nlight intensities in an image.  In particular, they specify that the sample  values  are  di-\nrectly  proportional  to gamma-corrected intensity values.  The gamma correction they specify\nis CIE Rec. 709.\n\nHowever, people sometimes work with approximations of PPM and PGM where the relationship  be-\ntween  the image intensities and the sample values are something else.  For example, the sam-\nple value might be directly proportional to the intensity with  no  gamma  correction  (often\ncalled \"linear intensity\").  Or a different gamma transfer function may be used.\n\npnmgamma  allows  you  to manipulate the transfer function, thus working with and/or creating\npseudo-PPM files that are useful for various things.\n\nFor example, if you feed a true PPM to pnmgamma -cieramp -ungamma, you get as output  a  file\nwhich  is PPM in every respect except that the sample values are directly proportional to the\nlight intensities in the image.  If you feed such a file to pnmgamma -cieramp, you get out  a\ntrue PPM.\n\nThe situation for PGM images is analogous.  And pnmgamma treats PBM images as PGM images.\n\nWhen  you  feed  a linear PPM image to a display program that expects a true PPM, the display\nappears darker than it should, so pnmgamma has the effect of lightening the image.  When  you\nfeed  a true PPM to a display program that expects linear sample values, and therefore does a\ngamma correction of its own on them, the display appears lighter than it should, so  pnmgamma\nwith a gamma value less than one (the multiplicative inverse of whatever gamma value the dis-\nplay program uses) has the effect of darkening the image.\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "The only parameters are the specification of the input image file and the gamma values.   Ev-\nery gamma transfer function pnmgamma uses contains an exponent, which is the gamma value, and\nyou can choose that value.\n\nFurthermore, you can choose different values for each of the three RGB  components.   If  you\nspecify only one gamma value, pnmgamma uses that value for all three RGB components.\n\nIf  you  don't  specify  any  gamma parameters, pnmgamma chooses a default.  For the transfer\nfunctions defined by standards, the default is the value defined by  the  standard.   If  you\nspecify  anything else, you will be varying from the standard.  For the simple power function\ntransfer function, the default gamma is 1/.45.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-ungamma",
                        "content": "Apply the inverse of the specified transfer function  (i.e.  go  from  gamma-corrected\nnonlinear intensities to linear intensities).\n"
                    },
                    {
                        "name": "-cieramp",
                        "content": "Use  the CIE Rec. 709 gamma transfer function.  Note that it is true CIE Rec. 709 only\nif you use the default gamma value (i.e. don't specify any  gamma  parameters).   This\ntransfer function is a power function modified with a linear ramp near black.\n\nIf  you  specify  neither  -cieramp nor -srgbramp, the transfer function defaults to a\nsimple power function.\n"
                    },
                    {
                        "name": "-srgbramp",
                        "content": "Use the Internation Electrotechnical Commission (IEC) SRGB gamma transfer function (as\nspecified  in  the standard IEC 61966-2-1).  Note that it is true SRGB only if you use\nthe default gamma value (i.e. don't specify  any  gamma  parameters).   This  transfer\nfunction is like the one selected by -cieramp, but with different constants in it.\n\nNote that SRGB is often spelled \"sRGB\".  In this document, we use standard English ty-\npography, though, which doesn't allow for that kind of capitalization.\n\nIf you specify neither -cieramp nor -srgbramp, the transfer  function  defaults  to  a\nsimple power function.\n\nWHAT IS GAMMA?\nA  good  explanation  of  gamma  is  in  Charles  Poynton's  GammaFAQ   at  <http://www.poyn-\nton.com/notes/colourandgamma/ColorFAQ.html>    and    ColorFAQ     at     <http://www.poyn-\nton.com/notes/colourandgamma/GammaFAQ.html>\n\nIn  brief: The simplest way to code an image is by using sample values that are directly pro-\nportional to the intensity of the color components.  But that wastes the sample space because\nthe  human  eye  can't discern differences between low-intensity colors as well as it can be-\ntween high-intensity colors.  So instead, we pass the light intensity values through a trans-\nfer function that makes it so that changing a sample value by 1 causes the same level of per-\nceived color change anywhere in the sample range.  We store those resulting values in the im-\nage  file.   That transfer function is called the gamma transfer function and the transforma-\ntion is called gamma correcting.\n\nVirtually all image formats, either specified or de facto,  use  gamma-corrected  values  for\ntheir sample values.\n\nWhat's  really nice about gamma is that by coincidence, the inverse function that you have to\ndo to convert the gamma-corrected values back to real light intensities is done automatically\nby  CRTs.   You  just  apply  a voltage to the CRT's electron gun that is proportional to the\ngamma-corrected sample value, and the intensity of light that comes  out  of  the  screen  is\nclose to the intensity value you had before you applied the gamma transfer function!\n\nAnd when you consider that computer video devices usually want you to store in video memory a\nvalue proportional to the signal voltage you want to go to the  monitor,  which  the  monitor\nturns  into a proportional drive voltage on the electron gun, it is really convenient to work\nwith gamma-corrected sample values.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "pnm(5)\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Copyright (C) 1991 by Bill Davidson and Jef Poskanzer.\n\n11 June 2001                               pnmgamma(1)",
                "subsections": []
            }
        }
    }
}