xref: /freebsd/share/man/man5/pbm.5 (revision aa0a1e58)
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.
66This variant is
67different in the following ways:
68.Pp
69.Bl -bullet -compact
70.It
71The "magic number" is "P4" instead of "P1".
72.It
73The bits are stored eight per byte, high bit first low bit last.
74.It
75No whitespace is allowed in the bits section, and only a single character
76of whitespace (typically a newline) is allowed after the height.
77.It
78The files are eight times smaller and many times faster to read and write.
79.El
80.Sh AUTHORS
81Copyright (C) 1989, 1991 by
82.An Jef Poskanzer .
83.\" Permission to use, copy, modify, and distribute this software and its
84.\" documentation for any purpose and without fee is hereby granted, provided
85.\" that the above copyright notice appear in all copies and that both that
86.\" copyright notice and this permission notice appear in supporting
87.\" documentation.  This software is provided "as is" without express or
88.\" implied warranty.
89