2 .\" $FreeBSD: src/share/man/man5/pbm.5,v 1.6.2.1 2000/12/14 14:10:37 ru Exp $
3 .\" $DragonFly: src/share/man/man5/Attic/pbm.5,v 1.2 2003/06/17 04:37:00 dillon Exp $
10 .Nd portable bitmap file format
12 The portable bitmap format is a lowest common denominator monochrome
14 It was originally designed to make it reasonable to mail bitmaps
15 between different types of machines using the typical stupid network
16 mailers we have today.
17 Now it serves as the common language of a large family of bitmap
19 The definition is as follows:
23 A "magic number" for identifying the file type.
24 A pbm file's magic number is the two characters "P1".
26 Whitespace (blanks, TABs, CRs, LFs).
28 A width, formatted as ASCII characters in decimal.
32 A height, again in ASCII decimal.
36 Width * height bits, each either '1' or '0', starting at the top-left
37 corner of the bitmap, proceeding in normal English reading order.
39 The character '1' means black, '0' means white.
41 Whitespace in the bits section is ignored.
43 Characters from a "#" to the next end-of-line are ignored (comments).
45 No line should be longer than 70 characters.
48 Here is an example of a small bitmap in this format:
53 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
54 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0
55 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0
56 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0
57 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
58 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0
59 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
62 Programs that read this format should be as lenient as possible,
63 accepting anything that looks remotely like a bitmap.
65 There is also a variant on the format, available
66 by setting the RAWBITS option at compile time. This variant is
67 different in the following ways:
71 The "magic number" is "P4" instead of "P1".
73 The bits are stored eight per byte, high bit first low bit last.
75 No whitespace is allowed in the bits section, and only a single character
76 of whitespace (typically a newline) is allowed after the height.
78 The files are eight times smaller and many times faster to read and write.
81 Copyright (C) 1989, 1991 by
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