What is XBM? X BitMap Format Explained

XBM (X BitMap) is a monochrome X Window System image format that stores 1-bit bitmaps as compilable C source code for icons and cursors.

Free online file converter tool. Works in Chrome Firefox Safari Edge Opera and other modern browsers on Windows macOS Linux Android and iOS. No software installation or sign-up required. All conversions run directly in your browser, so your files never leave your device. Free to use with no account needed.

Image

What is XBM? X BitMap Format Explained

A monochrome X Window System bitmap format stored as compilable C source code.

Last updated:

Year Created1980s
CompressionRaster (monochrome)
Primary UseX Window System icons

What is XBM?

XBM (X BitMap) is a monochrome image format used by the X Window System to store simple bitmaps such as icons and cursors. Its defining characteristic is that an XBM file is plain C source code rather than a conventional binary image file.

An XBM file consists of #define statements giving the width and height in pixels, followed by a static array of unsigned char values holding the 1-bit pixel data. Each byte encodes eight pixels, with the upper-left pixel in the low bit of the first byte. Because it is valid C, an XBM bitmap can be compiled directly into an application.

How XBM Works

An XBM file is plain C source code: it declares the image's width and height with #define statements and stores the 1-bit pixel data as a static array of unsigned char values.[1] Each byte holds eight pixels, with the upper-left pixel in the low bit of the first byte, so the bitmap can be compiled directly into a program.[1]

History and Context

XBM was created for the X Window System to store monochrome assets such as icons and cursors, and its source-code form let early X applications embed bitmaps without a separate image loader.[1]

XBM vs XPM

The later XPM format extended the same C-source idea to color and transparency by adding a character-to-color table, addressing XBM's strictly black-and-white limitation.[2] XBM remains far more compact per pixel but is confined to two-color images, making it suitable only for simple line art and masks.[1]

MKV Technical Specifications

DeveloperX Window System (MIT / X Consortium)[1]
File Extension.xbm[1]
MIME Typeimage/x-xbitmap[1]
Released1980s (with X Window System)[1]
Type1-bit monochrome bitmap (C source)[1]

XBM vs Other Image Formats

FeatureXBMPNGGIF
TypeRasterRasterRaster
Color depth1-bit (monochrome)[1]Up to 16-bit8-bit palette
EncodingC source code[1]BinaryBinary
CompressionNone[1]LosslessLossless (LZW)
TransparencyNoYesYes (1-bit)
Best forX11 bitmaps/icons[1]Web graphicsSimple animation

XBM stores monochrome bitmaps as compilable C arrays for the X Window System, a niche role unlike the general-purpose PNG and GIF.

Advantages & Disadvantages

Advantages

Compiles directly into code | FileFormer

Because an XBM file is C source, the bitmap can be #included and compiled straight into an application with no separate loader.

Human-readable and editable | FileFormer

The plain-text array can be inspected and edited in any text editor, which is convenient for tiny icons.

Very simple structure | FileFormer

With just width/height defines and a byte array, XBM is trivial to generate and parse programmatically.

Lightweight for small graphics | FileFormer

For small monochrome icons and cursors, XBM is a compact and dependency-free way to embed images.

Disadvantages

Monochrome only | FileFormer

XBM stores only 1-bit black-and-white pixels, with no support for grayscale or color.

Inefficient for storage | FileFormer

Encoding each byte as ASCII C hexadecimal makes files far larger than the raw pixel data they represent.

Largely superseded | FileFormer

XBM was superseded by XPM for color, and is now used mainly for simple UI elements in lightweight window managers.

Common Use Cases

XBM is used for small monochrome graphics within the X Window System and similar contexts.

X Window icons and cursors | FileFormer

XBM was the original format for cursor and icon bitmaps in the X GUI environment.

Embedded UI button images | FileFormer

Lightweight window managers such as Openbox still use XBM to define simple title-bar buttons like minimize and maximize.

Compiled-in graphics | FileFormer

Developers embed small monochrome bitmaps directly into C programs by including XBM source files.

Convert XBM Files Free

Use our free online converter to convert XBM and other formats - no signup, no watermarks.

Try Image Converter Free

Frequently Asked Questions

Why is an XBM file C source code?

XBM was designed so bitmaps could be compiled directly into X applications; the file is a #define and a static unsigned char array.

Does XBM support color?

No. XBM is strictly 1-bit monochrome; the color equivalent in the X Window System is XPM.

How are pixels stored in XBM?

Each byte holds eight pixels, with the upper-left pixel in the low bit of the first byte of the array.

Is XBM still used today?

Rarely for general images, but some lightweight window managers still use XBM for simple button and decoration bitmaps.

What is the difference between XBM and XPM?

XBM stores 1-bit monochrome bitmaps, while XPM (X PixMap) extends the idea to color images with transparency.

References

  1. X BitMap - Wikipedia
  2. X PixMap - Wikipedia