1997-03-07 03:28:23 +00:00
|
|
|
.\"
|
1997-06-23 04:03:49 +00:00
|
|
|
.\" $Id: pbm.5,v 1.3 1997/03/07 03:28:03 jmg Exp $
|
1997-03-07 03:28:23 +00:00
|
|
|
.\"
|
1997-06-23 04:03:49 +00:00
|
|
|
.Dd September 27, 1991
|
1996-12-21 23:30:53 +00:00
|
|
|
.Dt PBM 5
|
|
|
|
.Sh NAME
|
|
|
|
.Nm pbm
|
|
|
|
.Nd portable bitmap file format
|
|
|
|
.Sh DESCRIPTION
|
1996-02-12 05:17:28 +00:00
|
|
|
The portable bitmap format is a lowest common denominator monochrome
|
|
|
|
file format.
|
|
|
|
It was originally designed to make it reasonable to mail bitmaps
|
|
|
|
between different types of machines using the typical stupid network
|
|
|
|
mailers we have today.
|
|
|
|
Now it serves as the common language of a large family of bitmap
|
|
|
|
conversion filters.
|
|
|
|
The definition is as follows:
|
1996-12-21 23:30:53 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -bullet -compact
|
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
A "magic number" for identifying the file type.
|
|
|
|
A pbm file's magic number is the two characters "P1".
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
Whitespace (blanks, TABs, CRs, LFs).
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
A width, formatted as ASCII characters in decimal.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
Whitespace.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
A height, again in ASCII decimal.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
Whitespace.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
Width * height bits, each either '1' or '0', starting at the top-left
|
|
|
|
corner of the bitmap, proceeding in normal English reading order.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
The character '1' means black, '0' means white.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
Whitespace in the bits section is ignored.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
Characters from a "#" to the next end-of-line are ignored (comments).
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
No line should be longer than 70 characters.
|
1996-12-21 23:30:53 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
1996-02-12 05:17:28 +00:00
|
|
|
Here is an example of a small bitmap in this format:
|
1996-12-21 23:30:53 +00:00
|
|
|
.Bd -literal
|
1996-02-12 05:17:28 +00:00
|
|
|
P1
|
|
|
|
# feep.pbm
|
|
|
|
24 7
|
|
|
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
|
|
0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
|
|
|
|
0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
|
|
|
|
0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
|
|
|
|
0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
|
|
|
|
0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
|
|
|
|
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
1996-12-21 23:30:53 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
1996-02-12 05:17:28 +00:00
|
|
|
Programs that read this format should be as lenient as possible,
|
|
|
|
accepting anything that looks remotely like a bitmap.
|
1996-12-21 23:30:53 +00:00
|
|
|
.Pp
|
1996-02-12 05:17:28 +00:00
|
|
|
There is also a variant on the format, available
|
|
|
|
by setting the RAWBITS option at compile time. This variant is
|
|
|
|
different in the following ways:
|
1996-12-21 23:30:53 +00:00
|
|
|
.Pp
|
|
|
|
.Bl -bullet -compact
|
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
The "magic number" is "P4" instead of "P1".
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
The bits are stored eight per byte, high bit first low bit last.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
No whitespace is allowed in the bits section, and only a single character
|
|
|
|
of whitespace (typically a newline) is allowed after the height.
|
1996-12-21 23:30:53 +00:00
|
|
|
.It
|
1996-02-12 05:17:28 +00:00
|
|
|
The files are eight times smaller and many times faster to read and write.
|
1996-12-21 23:30:53 +00:00
|
|
|
.El
|
|
|
|
.Sh AUTHOR
|
1996-02-12 05:17:28 +00:00
|
|
|
Copyright (C) 1989, 1991 by Jef Poskanzer.
|
|
|
|
.\" Permission to use, copy, modify, and distribute this software and its
|
|
|
|
.\" documentation for any purpose and without fee is hereby granted, provided
|
|
|
|
.\" that the above copyright notice appear in all copies and that both that
|
|
|
|
.\" copyright notice and this permission notice appear in supporting
|
|
|
|
.\" documentation. This software is provided "as is" without express or
|
|
|
|
.\" implied warranty.
|