1ac5afce1SJohn-Mark Gurney.\" 2681e5e7aSSteve Price.Dd September 27, 1991 3c310249eSMike Pritchard.Dt PBM 5 488544700SRuslan Ermilov.Os 5c310249eSMike Pritchard.Sh NAME 6c310249eSMike Pritchard.Nm pbm 7c310249eSMike Pritchard.Nd portable bitmap file format 8c310249eSMike Pritchard.Sh DESCRIPTION 9ead93ec3SMike PritchardThe portable bitmap format is a lowest common denominator monochrome 10ead93ec3SMike Pritchardfile format. 11ead93ec3SMike PritchardIt was originally designed to make it reasonable to mail bitmaps 12ead93ec3SMike Pritchardbetween different types of machines using the typical stupid network 13ead93ec3SMike Pritchardmailers we have today. 14ead93ec3SMike PritchardNow it serves as the common language of a large family of bitmap 15ead93ec3SMike Pritchardconversion filters. 16ead93ec3SMike PritchardThe definition is as follows: 17c310249eSMike Pritchard.Pp 18c310249eSMike Pritchard.Bl -bullet -compact 19c310249eSMike Pritchard.It 20ead93ec3SMike PritchardA "magic number" for identifying the file type. 21ead93ec3SMike PritchardA pbm file's magic number is the two characters "P1". 22c310249eSMike Pritchard.It 23ead93ec3SMike PritchardWhitespace (blanks, TABs, CRs, LFs). 24c310249eSMike Pritchard.It 25ead93ec3SMike PritchardA width, formatted as ASCII characters in decimal. 26c310249eSMike Pritchard.It 27ead93ec3SMike PritchardWhitespace. 28c310249eSMike Pritchard.It 29ead93ec3SMike PritchardA height, again in ASCII decimal. 30c310249eSMike Pritchard.It 31ead93ec3SMike PritchardWhitespace. 32c310249eSMike Pritchard.It 33ead93ec3SMike PritchardWidth * height bits, each either '1' or '0', starting at the top-left 34ead93ec3SMike Pritchardcorner of the bitmap, proceeding in normal English reading order. 35c310249eSMike Pritchard.It 36ead93ec3SMike PritchardThe character '1' means black, '0' means white. 37c310249eSMike Pritchard.It 38ead93ec3SMike PritchardWhitespace in the bits section is ignored. 39c310249eSMike Pritchard.It 40ead93ec3SMike PritchardCharacters from a "#" to the next end-of-line are ignored (comments). 41c310249eSMike Pritchard.It 42ead93ec3SMike PritchardNo line should be longer than 70 characters. 43c310249eSMike Pritchard.El 44c310249eSMike Pritchard.Pp 45ead93ec3SMike PritchardHere is an example of a small bitmap in this format: 46c310249eSMike Pritchard.Bd -literal 47ead93ec3SMike PritchardP1 48ead93ec3SMike Pritchard# feep.pbm 49ead93ec3SMike Pritchard24 7 50ead93ec3SMike Pritchard0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51ead93ec3SMike Pritchard0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 52ead93ec3SMike Pritchard0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 53ead93ec3SMike Pritchard0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 54ead93ec3SMike Pritchard0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 55ead93ec3SMike Pritchard0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 56ead93ec3SMike Pritchard0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57c310249eSMike Pritchard.Ed 58c310249eSMike Pritchard.Pp 59ead93ec3SMike PritchardPrograms that read this format should be as lenient as possible, 60ead93ec3SMike Pritchardaccepting anything that looks remotely like a bitmap. 61c310249eSMike Pritchard.Pp 62ead93ec3SMike PritchardThere is also a variant on the format, available 635203edcdSRuslan Ermilovby setting the RAWBITS option at compile time. 645203edcdSRuslan ErmilovThis variant is 65ead93ec3SMike Pritcharddifferent in the following ways: 66c310249eSMike Pritchard.Pp 67c310249eSMike Pritchard.Bl -bullet -compact 68c310249eSMike Pritchard.It 69ead93ec3SMike PritchardThe "magic number" is "P4" instead of "P1". 70c310249eSMike Pritchard.It 71ead93ec3SMike PritchardThe bits are stored eight per byte, high bit first low bit last. 72c310249eSMike Pritchard.It 73ead93ec3SMike PritchardNo whitespace is allowed in the bits section, and only a single character 74ead93ec3SMike Pritchardof whitespace (typically a newline) is allowed after the height. 75c310249eSMike Pritchard.It 76ead93ec3SMike PritchardThe files are eight times smaller and many times faster to read and write. 77c310249eSMike Pritchard.El 78aaf1f16eSPhilippe Charnier.Sh AUTHORS 79aaf1f16eSPhilippe CharnierCopyright (C) 1989, 1991 by 80aaf1f16eSPhilippe Charnier.An Jef Poskanzer . 81ead93ec3SMike Pritchard.\" Permission to use, copy, modify, and distribute this software and its 82ead93ec3SMike Pritchard.\" documentation for any purpose and without fee is hereby granted, provided 83ead93ec3SMike Pritchard.\" that the above copyright notice appear in all copies and that both that 84ead93ec3SMike Pritchard.\" copyright notice and this permission notice appear in supporting 85ead93ec3SMike Pritchard.\" documentation. This software is provided "as is" without express or 86ead93ec3SMike Pritchard.\" implied warranty. 87