Portable Bitmap
image/x-portable-bitmap
Released 1988
· by Jef Poskanzer (Netpbm Project)
The image/x-portable-bitmap MIME type represents the Portable Bitmap (PBM) format, the simplest member of the Netpbm family of image formats. Created in the 1980s by Jef Poskanzer, PBM is designed strictly to store 1-bit monochrome (black and white) images without any compression. It supports two distinct encodings: a human-readable ASCII plaintext version (designated by the 'P1' magic number) where pixels are represented by '0' and '1' characters, and a raw binary version ('P4') that packs eight pixels into a single byte. Because of its extreme simplicity, it is widely used as an intermediary format in Unix-based image processing pipelines and optical character recognition (OCR) workflows.
Technical Specifications
.pbm
None
image/pbm
Magic Bytes & HTTP Headers
P1 or P4
Browser Support Matrix
| Browser | Status | Min Version |
|---|---|---|
|
|
Not Supported | — |
|
|
Not Supported | — |
|
|
Not Supported | — |
|
|
Not Supported | — |
|
|
Not Supported | Legacy |
Advantages & Limitations
- Absolute structural simplicity allows parsers to be written from scratch with just a few lines of code
- ASCII encoding allows manual editing and debugging directly within a standard text editor
- Serves as a flawless, lossless intermediary for 1-bit raster data like scanned documents or barcodes
- Strictly limited to 1-bit monochrome images; cannot natively display shades of gray or color
- Lack of compression results in extremely large file sizes, particularly when using the ASCII 'P1' encoding
- No support for alpha transparency or modern metadata standards like EXIF
Developer Code Snippets
File Detection Steps
How to programmatically detect a image/x-portable-bitmap
file by reading its raw bytes:
- 1 A PBM file always begins with a 2-byte magic number starting with 'P' (Hex: 50).
- 2 The second byte determines the encoding: '1' (Hex: 31) for plain ASCII text, and '4' (Hex: 34) for raw binary.
- 3 Following the magic bytes are whitespace-separated ASCII numbers defining the image's width and height. Unlike PGM and PPM formats, a PBM file does not include a 'maximum color value' parameter since it is strictly 1-bit.
Software Support
ImageMagick
Conversion Tools
Share & Embed
[](https://freewebptojpg.com/mime/image/pbm)
<iframe src="https://freewebptojpg.com/mime/image/pbm/embed" width="100%" height="280" style="border:1px solid #cbd5e1;border-radius:8px;" title="PBM Specs"></iframe>
JSON API
All data on this page is available as a free, open JSON API. Use it in your project, documentation, or tooling.
GET https://freewebptojpg.com/mime/image/pbm.json
Open JSON
Frequently Asked Questions
What is a PBM file?
A PBM (Portable Bitmap) file is a highly simplified 1-bit monochrome raster image format. It is part of the Netpbm project and stores images purely as black and white pixels without any shades of gray or color.
Can I open a PBM file in a text editor?
Yes, if the PBM file was saved using the 'plain' ASCII encoding (indicated by the magic number 'P1'). When opened in a text editor, you will see a grid of '0's (white) and '1's (black) that roughly form the shape of the image.
Why is the PBM format still used?
Despite lacking compression, PBM's absolute simplicity makes it incredibly easy for developers to read, write, and manipulate programmatically. It is often used as a stepping stone or temporary intermediary format in complex command-line image processing or OCR (Optical Character Recognition) software.