{
    "content": [
        {
            "type": "text",
            "text": "# pbm(5) (man)\n\n**Summary:** pbm - portable bitmap file format\n\n## See Also\n\n- libpbm(3)\n- pnm(5)\n- pgm(5)\n- ppm(5)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **DESCRIPTION** (83 lines)\n- **COMPATIBILITY** (4 lines)\n- **SEE ALSO** (2 lines)\n- **AUTHOR** (5 lines)\n\n## Full Content\n\n### NAME\n\npbm - portable bitmap file format\n\n### DESCRIPTION\n\nThe  portable bitmap format is a lowest common denominator monochrome file format.  It serves\nas the common language of a large family of bitmap conversion filters.   Because  the  format\npays  no heed to efficiency, it is simple and general enough that one can easily develop pro‐\ngrams to convert to and from just about any other graphics format, or to manipulate  the  im‐\nage.\n\nThis is not a format that one would normally use to store a file or to transmit it to someone\n-- it's too expensive and not expressive enough for that.  It's just an intermediary  format.\nIn it's purest use, it lives only in a pipe between two other programs.\n\nThe format definition is as follows.\n\nA  PBM  file consists of a sequence of one or more PBM images. There are no data, delimiters,\nor padding before, after, or between images.\n\nEach PBM image consists of the following:\n\n- A \"magic number\" for identifying the file type.  A pbm image's  magic  number  is  the  two\ncharacters \"P4\".\n\n- Whitespace (blanks, TABs, CRs, LFs).\n\n- The width in pixels of the image, formatted as ASCII characters in decimal.\n\n- Whitespace.\n\n- The height in pixels of the image, again in ASCII decimal.\n\n- Newline or other single whitespace character.\n\n- A  raster of Height rows, in order from top to bottom.  Each row is Width bits, packed 8 to\na byte, with don't care bits to fill out the last byte in the row.  Each bit  represents  a\npixel:  1  is  black,  0 is white.  The order of the pixels is left to right.  The order of\ntheir storage within each file byte is most significant bit to least significant bit.   The\norder of the file bytes is from the beginning of the file toward the end of the file.\n\n- Characters  from  a \"#\" to the next end-of-line, before the width/height line, are comments\nand are ignored.\n\nThere is actually another version of the PBM format, even more more simplistic, more lavishly\nwasteful  of  space  than PBM, called Plain PBM.  Plain PBM actually came first, but even its\ninventor couldn't stand its recklessly  squanderous  use  of  resources  after  a  while  and\nswitched  to what we now know as the regular PBM format.  But Plain PBM is so redundant -- so\noverstated -- that it's virtually impossible to break.  You can send it through the most lib‐\neral  mail system (which was the original purpose of the PBM format) and it will arrive still\nreadable.  You can flip a dozen random bits and easily piece back together the  original  im‐\nage.  And we hardly need to define the format here, because you can decode it by inspection.\n\nThe difference is:\n\n- There is exactly one image in a file.\n\n- The \"magic number\" is \"P1\" instead of \"P4\".\n\n- Each pixel in the raster is represented by a byte containing ASCII '1' or '0', representing\nblack and white respectively.  There are no fill bits at the end of a row.\n\n- White space in the raster section is ignored.\n\n- You can put any junk you want after the raster, if it starts with a white space character.\n\n- No line should be longer than 70 characters.\n\nHere is an example of a small bitmap in the plain PBM format:\nP1\n# feep.pbm\n24 7\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0\n0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0\n0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0\n0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0\n0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n\nYou can generate the Plain PBM format from the regular PBM format (first image  in  the  file\nonly) with the pnmtoplainpnm program.\n\n\nPrograms  that  read  this  format  should be as lenient as possible, accepting anything that\nlooks remotely like a bitmap.\n\n### COMPATIBILITY\n\nBefore July 2000, there could be at most one image in a PBM file.  As a result, most tools to\nprocess PBM files ignore (and don't read) any data after the first image.\n\n### SEE ALSO\n\nlibpbm(3),pnm(5),pgm(5),ppm(5)\n\n### AUTHOR\n\nCopyright (C) 1989, 1991 by Jef Poskanzer.\n\n\n\n05 March 2000                                     pbm(5)\n\n"
        }
    ],
    "structuredContent": {
        "command": "pbm",
        "section": "5",
        "mode": "man",
        "summary": "pbm - portable bitmap file format",
        "synopsis": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "libpbm",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/libpbm/3/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": "ppm",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/ppm/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 83,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}