ImageGear for C and C++ on Linux v20.0 - Updated
[No Target Defined] > File Formats and Compressions > File Formats > File Formats Reference > PBM

Full Name PBM (Portable Bitmap File Format)
Format ID IG_FORMAT_PBM = 28
File Extension(s) *.pbm
Data Type Raster Image
Data Encoding Binary
Color Profile Support No
Multi-Page Support No
Alpha Channel Support No

ImageGear Supported Versions:

October 1991 - last release

ImageGear Supported Features:

ImageGear Read Support:

ImageGear Write Support:

ImageGear Filter Control Parameters:



This is useful for quick and easy transfer of monochrome bitmap images, although the encoding scheme is not efficient in terms of storage space. This format, as well as the PGM, PNM, and PPM formats, are at the core of a set of utility programs also written by Jef Poskanzer. Among other things, these formats serve as intermediary storage methods for the conversion of other file formats.

The Portable Bitmap File Format structure is very simple. It begins with a short ASCII header that contains the file type identifier (magic number), the width and height of the image, and perhaps a comment line identifying the filename. Following white space (usually a carriage return) is the bitmap data. The number of bits is equal to the width * height. A pixel value of 0 indicates white, and a value of 1 indicates black.

The magic number of the header can have one of two values: either P1 or P4. P1 indicates that the bitmap data are to be read as ASCII decimal values. P4 indicates that the bitmap data are stored as plain bytes. Because 8 pixel values (1 bit each) are stored in one byte, the file is 8 times smaller than in the ASCII decimal format. White spaces are permitted in the P1 format but not permitted in the P4 format.

NOTE: Note: ImageGear uses IG_FORMAT_PBM filter to handle the whole family of formats: PBM (1-bit), PGM (grayscale), PPM (truecolor) and PNM (collective name for all of above). When saving image as IG_FORMAT_PBM format, ImageGear chooses particular format (PBM, PGM, PNM or PPM) depending on image bit depth.

See Also:


References Used

Kay, David C. and John R. Levine. Graphics File Formats, 2nd ed. Windcrest /McGraw-Hill, 1995.

PBM Specification by Jef Poskanzer, copyright © 1989, 1991.

Is this page helpful?
Yes No
Thanks for your feedback.