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