pbm.5 revision 20781
1.Dd "September 27, 1991" 2.Dt PBM 5 3.Sh NAME 4.Nm pbm 5.Nd portable bitmap file format 6.Sh DESCRIPTION 7The portable bitmap format is a lowest common denominator monochrome 8file format. 9It was originally designed to make it reasonable to mail bitmaps 10between different types of machines using the typical stupid network 11mailers we have today. 12Now it serves as the common language of a large family of bitmap 13conversion filters. 14The definition is as follows: 15.Pp 16.Bl -bullet -compact 17.It 18A "magic number" for identifying the file type. 19A pbm file's magic number is the two characters "P1". 20.It 21Whitespace (blanks, TABs, CRs, LFs). 22.It 23A width, formatted as ASCII characters in decimal. 24.It 25Whitespace. 26.It 27A height, again in ASCII decimal. 28.It 29Whitespace. 30.It 31Width * height bits, each either '1' or '0', starting at the top-left 32corner of the bitmap, proceeding in normal English reading order. 33.It 34The character '1' means black, '0' means white. 35.It 36Whitespace in the bits section is ignored. 37.It 38Characters from a "#" to the next end-of-line are ignored (comments). 39.It 40No line should be longer than 70 characters. 41.El 42.Pp 43Here is an example of a small bitmap in this format: 44.Bd -literal 45P1 46# feep.pbm 4724 7 480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 490 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 500 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 510 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 520 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 530 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 540 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55.Ed 56.Pp 57Programs that read this format should be as lenient as possible, 58accepting anything that looks remotely like a bitmap. 59.Pp 60There is also a variant on the format, available 61by setting the RAWBITS option at compile time. This variant is 62different in the following ways: 63.Pp 64.Bl -bullet -compact 65.It 66The "magic number" is "P4" instead of "P1". 67.It 68The bits are stored eight per byte, high bit first low bit last. 69.It 70No whitespace is allowed in the bits section, and only a single character 71of whitespace (typically a newline) is allowed after the height. 72.It 73The files are eight times smaller and many times faster to read and write. 74.El 75.Sh AUTHOR 76Copyright (C) 1989, 1991 by Jef Poskanzer. 77.\" Permission to use, copy, modify, and distribute this software and its 78.\" documentation for any purpose and without fee is hereby granted, provided 79.\" that the above copyright notice appear in all copies and that both that 80.\" copyright notice and this permission notice appear in supporting 81.\" documentation. This software is provided "as is" without express or 82.\" implied warranty. 83