{
    "mode": "man",
    "parameter": "ppm",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/ppm/5/json",
    "generated": "2026-05-30T06:05:12Z",
    "sections": {
        "NAME": {
            "content": "ppm - portable pixmap file format\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The portable pixmap format is a lowest common denominator color image file format.\n\nIt  should  be  noted  that  this format is egregiously inefficient.  It is highly redundant,\nwhile containing a lot of information that the human eye can't  even  discern.   Furthermore,\nthe  format  allows  very little information about the image besides basic color, which means\nyou may have to couple a file in this format with other independent information  to  get  any\ndecent use out of it.  However, it is very easy to write and analyze programs to process this\nformat, and that is the point.\n\nIt should also be noted that files often conform to this format in every respect  except  the\nprecise  semantics  of  the  sample values.  These files are useful because of the way PPM is\nused as an intermediary format.  They are informally called PPM files, but to  be  absolutely\nprecise,  you  should indicate the variation from true PPM.  For example, \"PPM using the red,\ngreen, and blue colors that the scanner in question uses.\"\n\nThe format definition is as follows.\n\nA PPM file consists of a sequence of one or more PPM images. There are no  data,  delimiters,\nor padding before, after, or between images.\n\nEach PPM image consists of the following:\n\n- A  \"magic  number\"  for  identifying  the file type.  A ppm image's magic number is the two\ncharacters \"P6\".\n\n- Whitespace (blanks, TABs, CRs, LFs).\n\n- A width, formatted as ASCII characters in decimal.\n\n- Whitespace.\n\n- A height, again in ASCII decimal.\n\n- Whitespace.\n\n- The maximum color value (Maxval), again in ASCII decimal.  Must be less than 65536.\n\n- Newline or other single whitespace character.\n\n- A raster of Width * Height pixels, proceeding through the image in normal  English  reading\norder.   Each pixel is a triplet of red, green, and blue samples, in that order.  Each sam‐\nple is represented in pure binary by either 1 or 2 bytes.  If the Maxval is less than  256,\nit is 1 byte.  Otherwise, it is 2 bytes.  The most significant byte is first.\n\n- In  the  raster, the sample values are \"nonlinear.\"  They are proportional to the intensity\nof the CIE Rec. 709 red, green, and blue in the pixel, adjusted by the CIE Rec.  709  gamma\ntransfer  function.  (That transfer function specifies a gamma number of 2.2 and has a lin‐\near section for small intensities).  A value of Maxval for all three samples represents CIE\nD65  white and the most intense color in the color universe of which the image is part (the\ncolor universe is all the colors in all images to which this image might be compared).\n\n- Note that a common variation on the PPM format is to have the sample  values  be  \"linear,\"\ni.e.  as  specified  above  except without the gamma adjustment.  pnmgamma takes such a PPM\nvariant as input and produces a true PPM as output.\n\n\n- Characters from a \"#\" to the next end-of-line, before the maxval line, are comments and are\nignored.\n\nNote that you can use pnmdepth to convert between a the format with 1 byte per sample and the\none with 2 bytes per sample.\n\nThere is actually another version of the PPM format that is fairly rare: \"plain\" PPM  format.\nThe  format  above, which generally considered the normal one, is known as the \"raw\" PPM for‐\nmat.  See pbm(5) for some commentary on how plain and raw formats relate to one another.\n\nThe difference in the plain format is:\n\n- There is exactly one image in a file.\n\n- The magic number is P3 instead of P6.\n\n- Each sample in the raster is represented as an ASCII decimal number (of arbitrary size).\n\n- Each sample in the raster has white space before and after it.  There must be at least  one\ncharacter  of  white  space  between any two samples, but there is no maximum.  There is no\nparticular separation of one pixel from another -- just the required separation between the\nblue sample of one pixel from the red sample of the next pixel.\n\n- No line should be longer than 70 characters.\n\nHere is an example of a small pixmap in this format:\nP3\n# feep.ppm\n4 4\n15\n0  0  0    0  0  0    0  0  0   15  0 15\n0  0  0    0 15  7    0  0  0    0  0  0\n0  0  0    0  0  0    0 15  7    0  0  0\n15  0 15    0  0  0    0  0  0    0  0  0\n\nPrograms  that  read  this  format  should be as lenient as possible, accepting anything that\nlooks remotely like a pixmap.\n\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "Before April 2000, a raw format PPM file could not have a maxval greater than 255.  Hence, it\ncould not have more than one byte per sample.  Old programs may depend on this.\n\nBefore July 2000, there could be at most one image in a PPM file.  As a result, most tools to\nprocess PPM files ignore (and don't read) any data after the first image.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "giftopnm(1), gouldtoppm(1), ilbmtoppm(1), imgtoppm(1), mtvtoppm(1), pcxtoppm(1), pgmtoppm(1),\npi1toppm(1),  picttoppm(1),  pjtoppm(1), qrttoppm(1), rawtoppm(1), rgb3toppm(1), sldtoppm(1),\nspctoppm(1), sputoppm(1), tgatoppm(1), ximtoppm(1), xpmtoppm(1),  yuvtoppm(1),  ppmtoacad(1),\nppmtogif(1),  ppmtoicr(1), ppmtoilbm(1), ppmtopcx(1), ppmtopgm(1), ppmtopi1(1), ppmtopict(1),\nppmtopj(1), ppmtopuzz(1), ppmtorgb3(1), ppmtosixel(1), ppmtotga(1), ppmtouil(1), ppmtoxpm(1),\nppmtoyuv(1),  ppmdither(1),  ppmforge(1), ppmhist(1), ppmmake(1), ppmpat(1), ppmquant(1), pp‐\nmquantall(1), ppmrelief(1), pnm(5), pgm(5), pbm(5)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright (C) 1989, 1991 by Jef Poskanzer.\n\n\n\n08 April 2000                                     ppm(5)",
            "subsections": []
        }
    },
    "summary": "ppm - portable pixmap file format",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "giftopnm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/giftopnm/1/json"
        },
        {
            "name": "gouldtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/gouldtoppm/1/json"
        },
        {
            "name": "ilbmtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ilbmtoppm/1/json"
        },
        {
            "name": "imgtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/imgtoppm/1/json"
        },
        {
            "name": "mtvtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mtvtoppm/1/json"
        },
        {
            "name": "pcxtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pcxtoppm/1/json"
        },
        {
            "name": "pgmtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgmtoppm/1/json"
        },
        {
            "name": "pi1toppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pi1toppm/1/json"
        },
        {
            "name": "picttoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/picttoppm/1/json"
        },
        {
            "name": "pjtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pjtoppm/1/json"
        },
        {
            "name": "qrttoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/qrttoppm/1/json"
        },
        {
            "name": "rawtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rawtoppm/1/json"
        },
        {
            "name": "rgb3toppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/rgb3toppm/1/json"
        },
        {
            "name": "sldtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/sldtoppm/1/json"
        },
        {
            "name": "spctoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/spctoppm/1/json"
        },
        {
            "name": "sputoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/sputoppm/1/json"
        },
        {
            "name": "tgatoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/tgatoppm/1/json"
        },
        {
            "name": "ximtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ximtoppm/1/json"
        },
        {
            "name": "xpmtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/xpmtoppm/1/json"
        },
        {
            "name": "yuvtoppm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/yuvtoppm/1/json"
        },
        {
            "name": "ppmtoacad",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtoacad/1/json"
        },
        {
            "name": "ppmtogif",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtogif/1/json"
        },
        {
            "name": "ppmtoicr",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtoicr/1/json"
        },
        {
            "name": "ppmtoilbm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtoilbm/1/json"
        },
        {
            "name": "ppmtopcx",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopcx/1/json"
        },
        {
            "name": "ppmtopgm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopgm/1/json"
        },
        {
            "name": "ppmtopi1",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopi1/1/json"
        },
        {
            "name": "ppmtopict",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopict/1/json"
        },
        {
            "name": "ppmtopj",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopj/1/json"
        },
        {
            "name": "ppmtopuzz",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtopuzz/1/json"
        },
        {
            "name": "ppmtorgb3",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtorgb3/1/json"
        },
        {
            "name": "ppmtosixel",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtosixel/1/json"
        },
        {
            "name": "ppmtotga",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtotga/1/json"
        },
        {
            "name": "ppmtouil",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtouil/1/json"
        },
        {
            "name": "ppmtoxpm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtoxpm/1/json"
        },
        {
            "name": "ppmtoyuv",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmtoyuv/1/json"
        },
        {
            "name": "ppmdither",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmdither/1/json"
        },
        {
            "name": "ppmforge",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmforge/1/json"
        },
        {
            "name": "ppmhist",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmhist/1/json"
        },
        {
            "name": "ppmmake",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmmake/1/json"
        },
        {
            "name": "ppmpat",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmpat/1/json"
        },
        {
            "name": "ppmquant",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmquant/1/json"
        },
        {
            "name": "mquantall",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/mquantall/1/json"
        },
        {
            "name": "ppmrelief",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ppmrelief/1/json"
        },
        {
            "name": "pnm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pnm/5/json"
        },
        {
            "name": "pgm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pgm/5/json"
        },
        {
            "name": "pbm",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/pbm/5/json"
        }
    ]
}