Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / share / man / man5 / pbm.5
1 .\"
2 .\" $FreeBSD: src/share/man/man5/pbm.5,v 1.6.2.1 2000/12/14 14:10:37 ru Exp $
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
11 The portable bitmap format is a lowest common denominator monochrome
12 file format.
13 It was originally designed to make it reasonable to mail bitmaps
14 between different types of machines using the typical stupid network
15 mailers we have today.
16 Now it serves as the common language of a large family of bitmap
17 conversion filters.
18 The definition is as follows:
19 .Pp
20 .Bl -bullet -compact
21 .It
22 A "magic number" for identifying the file type.
23 A pbm file's magic number is the two characters "P1".
24 .It
25 Whitespace (blanks, TABs, CRs, LFs).
26 .It
27 A width, formatted as ASCII characters in decimal.
28 .It
29 Whitespace.
30 .It
31 A height, again in ASCII decimal.
32 .It
33 Whitespace.
34 .It
35 Width * height bits, each either '1' or '0', starting at the top-left
36 corner of the bitmap, proceeding in normal English reading order.
37 .It
38 The character '1' means black, '0' means white.
39 .It
40 Whitespace in the bits section is ignored.
41 .It
42 Characters from a "#" to the next end-of-line are ignored (comments).
43 .It
44 No line should be longer than 70 characters.
45 .El
46 .Pp
47 Here is an example of a small bitmap in this format:
48 .Bd -literal
49 P1
50 # feep.pbm
51 24 7
52 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
53 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
54 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
55 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
56 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
57 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
58 0 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
61 Programs that read this format should be as lenient as possible,
62 accepting anything that looks remotely like a bitmap.
63 .Pp
64 There is also a variant on the format, available
65 by setting the RAWBITS option at compile time.  This variant is
66 different in the following ways:
67 .Pp
68 .Bl -bullet -compact
69 .It
70 The "magic number" is "P4" instead of "P1".
71 .It
72 The bits are stored eight per byte, high bit first low bit last.
73 .It
74 No whitespace is allowed in the bits section, and only a single character
75 of whitespace (typically a newline) is allowed after the height.
76 .It
77 The files are eight times smaller and many times faster to read and write.
78 .El
79 .Sh AUTHORS
80 Copyright (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.