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