{
    "content": [
        {
            "type": "text",
            "text": "# pamdepth (man)\n\n## NAME\n\npamdepth - change the depth (color resolution) in a Netpbm image\n\n## SYNOPSIS\n\npamdepth newmaxval [netpbmfile]\n\n## DESCRIPTION\n\nThis program is part of Netpbm(1).\n\n## TLDR\n\n> Reduce the depth (i.e. color resolution) in an image.\n\n- Read a PBM image, set its maxval and save it to a file:\n  `pamdepth {{maxval}} {{path/to/image.pbm}} > {{path/to/file.pbm}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (1 subsections)\n- **OPTIONS**\n- **SEE ALSO**\n- **HISTORY**\n- **DOCUMENT SOURCE**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "pamdepth",
        "section": "",
        "mode": "man",
        "summary": "pamdepth - change the depth (color resolution) in a Netpbm image",
        "synopsis": "pamdepth newmaxval [netpbmfile]",
        "tldr_summary": "Reduce the depth (i.e. color resolution) in an image.",
        "tldr_examples": [
            {
                "description": "Read a PBM image, set its maxval and save it to a file",
                "command": "pamdepth {{maxval}} {{path/to/image.pbm}} > {{path/to/file.pbm}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "pnm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnm/1/json"
            },
            {
                "name": "pam",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pam/1/json"
            },
            {
                "name": "pnmquant",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pnmquant/1/json"
            },
            {
                "name": "ppmdither",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/ppmdither/1/json"
            },
            {
                "name": "pambrighten",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pambrighten/1/json"
            },
            {
                "name": "pamfunc",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/pamfunc/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 24,
                "subsections": [
                    {
                        "name": "Output Format",
                        "lines": 16
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DOCUMENT SOURCE",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "pamdepth - change the depth (color resolution) in a Netpbm image\n\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "pamdepth newmaxval [netpbmfile]\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This program is part of Netpbm(1).\n\npamdepth  reads a Netpbm image as input, changes its depth (color resolution), and writes out\nthe resulting Netpbm image.  I.e. the output has a different maxval from the input,  but  all\nthe same colors (apart from rounding error).\n\nReducing the depth results in some loss of information.\n\nHere  is  an  example of the effect at the image format level: Assume you start with an image\nwith maxval 100 and sample values of 50 and 100.  You tell pamdepth to  change  it  to  depth\n150.  The output has maxval 200 and sample values 75 and 150.\n\nThis program works on multi-image streams.\n\nBe  careful of off-by-one errors when choosing the new maxval.  For instance, if you want the\ncolor values to be five bits wide, use a maxval of 31, not 32.\n\nOne important use of pamdepth is to convert a new format 2-byte-per-sample PNM  file  to  the\nolder  1-byte-per-sample  format.  Before April 2000, essentially all raw (binary) format PNM\nfiles had a maxval less than 256 and one byte per sample, and many programs may rely on that.\nIf you specify a newmaxval less than 256, the resulting file should be readable by  any  pro‐\ngram that worked with PNM files before April 2000.\n\n",
                "subsections": [
                    {
                        "name": "Output Format",
                        "content": "The  output  format (PBM, etc.) and, in the case of PAM, tuple type, of the output is usually\nthe same as the input.\n\nHowever, changing the depth of a black and white image does not make sense, except to turn it\ninto a grayscale image, so if the input is a black and white image, pamdepth makes the output\ngrayscale.  To be more precise, if the input is a PBM image, the output is PGM,  and  if  the\ninput  is a PAM with tuple type BLACKANDWHITE or BLACKANDWHITEALPHA, the output is a PAM\nwith tuple type GRAYSCALE or GRAYSCALEALPHA, respectively.\n\nThis conversion happens even if the new maxval is 1.\n\nBefore Netpbm 10.92 (September 2020), pamdepth failed if the input was PAM with a  black  and\nwhite tuple type and the new maxval was anything but 1.  But it always promoted PBM to PGM.\n\n\n"
                    }
                ]
            },
            "OPTIONS": {
                "content": "There  are  no  command line options defined specifically for pamdepth, but it recognizes the\noptions common to all programs based on libnetpbm (See \u001b]8;;index.html#commonoptions\u001b\\ Common Options\u001b]8;;\u001b\\ .)\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "pnm(1), pam(1), pnmquant(1), ppmdither(1) pambrighten(1) pamfunc(1)\n\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "pamdepth was new in Netpbm 10.32 (February 2006).  It replaced pnmdepth,  by  Jef  Poskanzer.\npamdepth  is  backward compatible with pnmdepth and adds the ability to process arbitrary PAM\nimages and the ability to process multi-image input streams.  pnmdepth handled only  PNM  im‐\nages and ignored all but the first in any stream.\n",
                "subsections": []
            },
            "DOCUMENT SOURCE": {
                "content": "This  manual  page  was  generated by the Netpbm tool 'makeman' from HTML source.  The master\ndocumentation is at\n\nhttp://netpbm.sourceforge.net/doc/pamdepth.html\n\nnetpbm documentation                       26 August 2020                    Pamdepth User Manual(1)",
                "subsections": []
            }
        }
    }
}