PBMA Files
ASCII Portable Bit Map Graphics Files
PBMA is a data directory which
contains examples of the ASCII version of the portable bitmap (PBM) format,
a lowest common denominator monochrome (black and white) file format.
It was originally designed to make it reasonable to mail bitmaps between
different types of machines. Now it serves as the common language
of a large family of bitmap conversion filters.
The definition is as follows:
-
the typical file extension is ".pbm", but an extension of
".pnm" is also occasionally used.
-
A "magic number" for identifying the file type. An
ASCII PBM file's magic number is the two characters "P1".
-
Whitespace (blanks, TABs, CRs, LFs).
-
A width, formatted as ASCII characters in decimal.
-
Whitespace.
-
A height, again in ASCII decimal.
-
Whitespace.
-
Width * height bits, each either '1' or '0', starting at the top-left
corner of the bitmap, proceeding in normal English reading order.
The character '1' means black, '0' means white.
Whitespace in the bits section is ignored.
Characters from a "#" to the next end-of-line are ignored (comments).
No line should be longer than 70 characters.
Example ASCII PBM file:
P1
# feep.ascii.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
ASCII PBM File Characteristics:
-
ASCII
-
black and white
-
2D
-
No compression
-
1 image
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Related Data and Programs:
PBMA_IO,
a C++ library which
handles the Portable Bit Map (ASCII) format.
PBMB,
a data directory which
contains examples of PBMB files,
binary Portable Bit Map 2D graphics, black and white;
PBMLIB,
a C library which
reads or writes
graphics files in the Portable Bit Map format;
PGMA,
a data directory which
contains examples of PGMA files,
ASCII Portable Gray Map, 2D graphics;
PPMA,
a data directory which
contains examples of PPMA files,
Portable Pixel Map (ASCII) 2D graphics, color;
Reference:
-
the NETPBM homepage.
Sample Files:
All the filenames here include the extension "ascii.pbm". The "ascii" part
just helps me to distinguish these files from their binary versions, and is
not required by any program.
-
circle.ascii.pbm,
a circle, drawn on a 200 by 200 grid;
-
circle.png,
a PNG version.
-
feep.ascii.pbm,
the example described above, on a 24 by 7 grid;
-
feep.png,
a PNG version.
-
fool.ascii.pbm,
a screenshot from "The Fool's Errand".
-
fool.png,
a PNG version.
-
gerrymander.ascii.pbm,
an image of the "Gerry-mander", on a 303 by 325 grid;
-
gerrymander.png,
a PNG version.
-
letter_a.ascii.pbm, a capital A,
using a 25 by 25 grid.
-
letter_a.png,
a PNG version.
-
scs.ascii.pbm,
the letters "SCS", on a 136 by 82 grid;
-
scs.png,
a PNG version.
-
seahorse.ascii.pbm,
a seahorse, on a 2225 by 3601 grid;
-
seahorse.png,
a PNG version.
-
sierpinski.ascii.pbm,
the Sierpinski triangle, on a 966 by 860 grid;
-
sierpinski.png,
a PNG version.
-
washington.ascii.pbm,
a silhouette of George Washington, on a 305 by 400 grid;
-
washington.png,
a PNG version.
You can go up one level to
the DATA page.
Last revised on 11 January 2011.