{
    "mode": "man",
    "parameter": "pamtopnm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/pamtopnm/1/json",
    "generated": "2026-10-06T13:27:41Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "pamtopnm - convert PAM image to PBM, PGM, or PPM\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "pamtopnm",
                    "content": "[-assume]\n\n[pnmfile]\n\nMinimum  unique  abbreviation of option is acceptable.  You may use double hyphens instead of\nsingle hyphen to denote options.  You may use white space in place of the equals sign to sep‐\narate an option name from its value.\n\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\npamtopnm reads a PAM image as input and produces an equivalent PBM, PGM, or  PPM  (i.e.  PNM)\nimage, whichever is most appropriate, as output.\n\npamtopnm assumes the PAM image represents the information required for a PBM, PGM, or PPM im‐\nage  if its tuple type is \"BLACKANDWHITE\", \"GRAYSCALE\", or \"RGB\" and its depth and maxval are\nappropriate.  If this is not the case, pamtopnm fails.\n\nHowever, you can override the tuple type requirement with the -assume option.\n\npamtopnm produces a PPM image if the input PAM has depth 3 or 4; it produces PGM  or  PBM  if\nthe  input PAM has depth 1 or 2.  Whether it produced PGM or PBM depends upon the maxval: PBM\nfor 1, PGM for anything higher.  The tuple type does not play a role in determining the  out‐\nput  type.   You can use Netpbm programs such as pgmtopgm to generate a different PNM output,\nbut remember that Netpbm program that expects PGM input will take PBM and so on.\n\nNote that it's possible for an image which is formally color to in fact contain  only  shades\nof  gray  and for an image which is formally grayscale to contain only black and white.  This\nprogram pays no attention to that; an RGB input image produces a PPM output image even if all\nthe pixels are gray.  But you can use ppmtopgm to convert a PPM that you know is grayscale to\nthe equivalent PGM, and you can use pamthreshold to convert a PGM image you know is black and\nwhite to a black and white PAM image and then use pamtopnm to convert that to PBM.\n\n\nAs with any Netpbm program that reads PAM images, pamtopnm also reads PNM images as  if  they\nwere PAM.  In that case, pamtopnm's functions reduces to simply copying the input to the out‐\nput.   But  this can be useful in a program that doesn't know whether its input is PAM or PNM\nbut needs to feed it to a program that only recognizes PNM.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "In addition to the options common to all programs based on libnetpbm  (most  notably  -quiet,\nsee  Common Options ), pamtopnm recognizes the following command line option:\n\n\n",
            "subsections": [
                {
                    "name": "-assume",
                    "content": "When  you  specify  -assume,  you tell pamtopnm that you personally vouch for the fact\nthat the tuples contain the same data as belongs in the channels of a PBM, PGM, or PPM\nfile.  The depth must still conform, though, so to truly force a conversion,  you  may\nhave  to  run  the input through pamchannel first.  But be careful with -assume.  When\nyou -assume, you make an -ass of u and me.\n\n\n\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "pbmtopgm(1),  pamditherbw(1),  pgmtoppm(1),  ppmtopgm(1),  pamthreshold(1),  pam(1),  pnm(1),\npbm(1), pgm(1), ppm(1)\n\n\n",
            "subsections": []
        },
        "HISTORY": {
            "content": "pamtopnm was new, along with the PAM format, in Netpbm 9.7 (August 2000).\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/pamtopnm.html\n\nnetpbm documentation                      02 February 2018                   Pamtopnm User Manual(1)",
            "subsections": []
        }
    },
    "summary": "pamtopnm - convert PAM image to PBM, PGM, or PPM",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "When you specify -assume, you tell pamtopnm that you personally vouch for the fact that the tuples contain the same data as belongs in the channels of a PBM, PGM, or PPM file. The depth must still conform, though, so to truly force a conversion, you may have to run the input through pamchannel first. But be careful with -assume. When you -assume, you make an -ass of u and me."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "pbmtopgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pbmtopgm/1/json"
        },
        {
            "name": "pamditherbw",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamditherbw/1/json"
        },
        {
            "name": "pgmtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgmtoppm/1/json"
        },
        {
            "name": "ppmtopgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopgm/1/json"
        },
        {
            "name": "pamthreshold",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pamthreshold/1/json"
        },
        {
            "name": "pam",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pam/1/json"
        },
        {
            "name": "pnm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/1/json"
        },
        {
            "name": "pbm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pbm/1/json"
        },
        {
            "name": "pgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgm/1/json"
        },
        {
            "name": "ppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert a PAM image to an equivalent PNM image.",
        "examples": [
            {
                "description": "Convert a PAM image to an equivalent PNM image, i.e. a PBM, PGM, or PPM image",
                "command": "pamtopnm {{path/to/image.pam}} > {{path/to/output.pbm|pgm|ppm}}"
            },
            {
                "description": "Display version",
                "command": "pamtopnm {{-v|-version}}"
            }
        ]
    }
}