{
    "mode": "man",
    "parameter": "ppmtopgm",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ppmtopgm/1/json",
    "generated": "2026-09-04T03:36:43Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "ppmtopgm - convert a PPM image to a PGM image\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "ppmtopgm",
                    "content": "[ppmfile]\n\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\nppmtopgm  reads  a  PPM  as  input  and produces a PGM as output.  The output is a \"black and\nwhite\" rendering of the original image, as in a black and white photograph.  The quantization\nformula ppmtopgm uses is y = .299 r + .587 g + .114 b.\n\nThe dimensions and maxval of the output are the same as the input.  Note that with  only  one\ncolor  plane,  there  are far fewer brightnesses that can be represented with the same maxval\nthan with three color planes, so you may want to  increase  the  maxval  of  the  input  with\npamdepth before giving it to ppmtopgm to avoid loss of information.  For example, with a max‐\nval of 1, there are 8 brightnesses that are possible in a PPM (though some of them are barely\ndistinguishable), but only 2 brightness levels possible in a PGM.\n\nNote  that  although  there is a pgmtoppm program, it is not necessary for simple conversions\nfrom pgm to ppm , because any ppm program can read pgm (and pbm ) files automatically.   pgm‐\ntoppm  is  for  colorizing a pgm file.  Also, see ppmtorgb3 for a different way of converting\ncolor to gray.  And ppmdist generates a grayscale image from a color image, but in a way that\nmakes it easy to differentiate the original colors, not necessarily a way that looks  like  a\nblack and white photograph.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "There  are  no  command line options defined specifically for ppmtopgm, 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": []
        },
        "QUOTE": {
            "content": "Cold-hearted orb that rules the night\nRemoves the colors from our sight\nRed is gray, and yellow white\nBut we decide which is right\nAnd which is a quantization error.\n\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "pgmtoppm(1), ppmtorgb3(1), rgb3toppm(1), ppmdist(1), ppm(1), pgm(1)\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1989 by Jef Poskanzer.\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/ppmtopgm.html\n\nnetpbm documentation                        25 June 2017                     Ppmtopgm User Manual(1)",
            "subsections": []
        }
    },
    "summary": "ppmtopgm - convert a PPM image to a PGM image",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "pgmtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgmtoppm/1/json"
        },
        {
            "name": "ppmtorgb3",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtorgb3/1/json"
        },
        {
            "name": "rgb3toppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rgb3toppm/1/json"
        },
        {
            "name": "ppmdist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmdist/1/json"
        },
        {
            "name": "ppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppm/1/json"
        },
        {
            "name": "pgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgm/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Convert a PPM image to a PGM image.",
        "examples": [
            {
                "description": "Convert PPM image to PGM image",
                "command": "ppmtopgm {{path/to/file.ppm}} > {{path/to/file.pgm}}"
            },
            {
                "description": "Display version",
                "command": "ppmtopgm {{-v|-version}}"
            }
        ]
    }
}