Convert HDR to XBM

Drag and drop files here or click to select.
Max file size 100mb.
Uploading progress:

HDR vs XBM Format Comparison

Aspect HDR (Source Format) XBM (Target Format)
Format Overview
HDR
Radiance RGBE High Dynamic Range

Developed by Greg Ward in 1985 for the Radiance lighting simulation system, HDR stores pixel data using a shared exponent encoding (RGBE) that captures a vast luminance range from deep shadows to brilliant highlights. Each pixel uses 32 bits with a shared 8-bit exponent, enabling representation of real-world lighting conditions far beyond what standard 8-bit images can hold. HDR is foundational in 3D rendering, architectural visualization, and photographic tone mapping.

Lossless Standard
XBM
X BitMap

Introduced in 1989 as part of the X Window System (X11), XBM is a monochrome bitmap format that stores images as plain C source code arrays. Each pixel is either black (1) or white (0), with the bitmap data represented as hexadecimal byte values in a C header file. XBM was designed for X11 cursor images, window icons, and toolbar buttons. Despite being limited to two colors, XBM remains relevant for embedded systems, retro computing, and any application where images must be compiled directly into C/C++ code.

Lossless Legacy
Technical Specifications
Color Depth: 32-bit RGBE (shared exponent float)
Compression: Run-length encoded RGBE
Transparency: Not supported
Animation: Not supported
Extensions: .hdr, .pic
Color Depth: 1-bit (monochrome — black and white only)
Compression: None (plain text C source code)
Transparency: Implicit (white pixels treated as transparent in X11)
Animation: Not supported
Extensions: .xbm
Image Features
  • Dynamic Range: Extreme (~76 orders of magnitude)
  • Transparency: Not supported
  • Metadata: Basic header (resolution, orientation)
  • Color Space: Linear or gamma-corrected RGB
  • HDR: Native — designed specifically for HDR data
  • Tone Mapping: Required for display on standard monitors
  • Dynamic Range: 1-bit (two values only)
  • Transparency: Convention-based in X11 (white = transparent)
  • Metadata: Width, height, and optional hotspot (x, y)
  • Color Space: Monochrome (black and white)
  • HDR: Not applicable (1-bit depth)
  • Source Code: Valid C code — compilable directly
Processing & Tools

HDR image processing with command-line tools:

# Tone map HDR for standard display
magick input.hdr -auto-level output.png

# Convert with threshold for monochrome
magick input.hdr -auto-level \
  -threshold 50% output.xbm

XBM creation and usage:

# Convert image to XBM
magick input.png -threshold 50% output.xbm

# XBM file is valid C code:
#define icon_width 16
#define icon_height 16
static unsigned char icon_bits[] = {
   0xff, 0xff, 0x01, 0x80, ...};
Advantages
  • Captures full real-world luminance range
  • Industry standard for environment maps and IBL
  • Compact RGBE encoding for floating-point data
  • Essential for physically-based rendering workflows
  • Preserves lighting data for post-processing flexibility
  • Widely supported in 3D software and game engines
  • Plain text format — human-readable and editable
  • Valid C source code — compiles directly into applications
  • Extremely small file size for icon-sized images
  • No external library needed to parse
  • Native X11 cursor and icon format
  • Perfect for embedded systems with limited resources
  • Version-control friendly (text diffs)
Disadvantages
  • Not displayable directly — requires tone mapping
  • Limited software support outside 3D/VFX tools
  • No transparency or alpha channel
  • RGBE encoding has precision limitations in dark areas
  • Not suitable for web browsers or standard image viewers
  • Monochrome only — no grayscale or color
  • No compression — text encoding is space-inefficient
  • Impractical for images larger than icons
  • Very limited software support for viewing
  • No web browser display support
Common Uses
  • Environment maps for 3D rendering (IBL)
  • Architectural lighting simulation
  • HDR photography source files
  • Game engine skyboxes and light probes
  • VFX compositing and color grading
  • X11 window manager cursors and icons
  • Embedded system display graphics
  • Compiled-in application resources
  • Retro computing and pixel art
  • Monochrome display output (e-ink, LCD)
Best For
  • 3D rendering and physically-based lighting
  • HDR photography and bracketed exposure merging
  • Environment mapping and image-based lighting
  • Scientific imaging requiring wide dynamic range
  • X Window System cursor and icon creation
  • Embedding bitmap graphics in C/C++ source code
  • Embedded systems with monochrome displays
  • Simple icons where file size must be minimal
  • Applications needing no external image library
Version History
Introduced: 1985 (Greg Ward, Radiance system)
Current Version: RGBE format (stable since inception)
Status: Mature, industry standard for HDR
Evolution: HDR/RGBE (1985) — OpenEXR (1999) emerged as HDR alternative
Introduced: 1989 (X Consortium, part of X11)
Current Version: XBM (stable, unchanged since X11R4)
Status: Legacy, still supported in X11/Xlib
Evolution: XBM (1989) → XPM (1989, added color) → PNG replaced both for general use
Software Support
Image Editors: Photoshop, GIMP, Luminance HDR, Photomatix
Web Browsers: Not supported
OS Preview: Limited — requires HDR-aware viewers
3D Software: Blender, Maya, 3ds Max, Unity, Unreal Engine
CLI Tools: ImageMagick, Pillow, OpenCV, radiance
Image Editors: GIMP, ImageMagick, bitmap (X11 utility)
Web Browsers: Not supported
OS Preview: Linux/X11 native, others via converters
Libraries: Pillow, Xlib, Tk (Tcl/Tk), stb_image
CLI Tools: ImageMagick, bitmap, atobm, Pillow

Why Convert HDR to XBM?

Converting HDR to XBM serves a highly specialized purpose: extracting silhouette or threshold-based representations from high dynamic range imagery for use in X11 applications, embedded systems, or compiled-in C/C++ resources. While this conversion dramatically reduces the visual information (from 32-bit floating-point to 1-bit monochrome), the resulting XBM captures the essential shape and contrast boundaries of the HDR image in the simplest possible format — one that can be included directly in source code without any image loading library.

The most practical application of HDR-to-XBM conversion is generating high-contrast icons or cursors from HDR-captured reference images. For example, a product designer might capture an object in HDR to preserve all surface detail, then convert to XBM to create a monochrome icon representation for an X11 application toolbar. The HDR source ensures clean edge detection during the thresholding process, as the wide dynamic range provides unambiguous boundaries between foreground and background.

For embedded systems development, XBM is one of the few image formats that requires zero external dependencies to parse. Since XBM files are plain C source code containing an array of bytes, they can be compiled directly into a microcontroller firmware without any image decoding library. Converting HDR captures of real-world objects to XBM creates compact monochrome representations for e-ink displays, OLED screens, or LED matrix indicators.

Be aware that this conversion involves extreme data reduction. The HDR file's 32-bit floating-point pixels are first tone-mapped, then converted to grayscale, then thresholded to produce a pure black-and-white output. The threshold level determines which tones become black and which become white. For best results, adjust the threshold to capture the most important features of the HDR image — typically the high-contrast edges and primary shapes.

Key Benefits of Converting HDR to XBM:

  • Compilable Source Code: XBM is valid C — include directly in applications
  • Zero Dependencies: No image library needed to parse or display
  • Minimal File Size: 1-bit depth produces extremely compact images
  • X11 Native: Direct use as X Window System cursors and icons
  • Embedded Friendly: Ideal for microcontrollers and resource-constrained devices
  • Clean Thresholding: HDR's wide range produces clean edge separation
  • Version Control: Plain text format produces meaningful diffs in git

Practical Examples

Example 1: X11 Window Manager Custom Cursor

Scenario: A Linux desktop environment developer captures an HDR photograph of a custom pointer shape and needs to convert it to XBM for use as an X11 cursor bitmap.

Source: cursor_design.hdr (0.8 MB, 256x256, 32-bit RGBE)
Conversion: HDR → XBM (thresholded at 50%)
Result: cursor_design.xbm (2 KB, 32x32, 1-bit monochrome)

X11 cursor workflow:
1. Design cursor shape, capture as HDR for clean edges
2. Resize to 32x32 cursor standard size
3. Convert to XBM with threshold for black/white cursor
4. Load with XCreateBitmapFromData() in Xlib application
✓ HDR source provides sharp edge detection
✓ XBM output is direct Xlib cursor input
✓ File is 2 KB of readable C code

Example 2: Embedded System E-Ink Display Icon

Scenario: An IoT developer needs monochrome icons for an e-ink weather display. They capture weather symbols in HDR for maximum contrast definition, then convert to XBM for firmware compilation.

Source: sun_symbol.hdr (0.4 MB, 128x128, RGBE)
Conversion: HDR → XBM (threshold optimized for shape clarity)
Result: sun_symbol.xbm (1.2 KB, 48x48, 1-bit monochrome)

Embedded development workflow:
1. Capture/design weather icons with HDR for edge precision
2. Resize to e-ink display resolution (48x48)
3. Convert to XBM — output is a C header file
4. #include "sun_symbol.xbm" in firmware source
✓ No image decoder needed in firmware — saves flash memory
✓ Compiles directly into microcontroller binary
✓ Clean shapes from HDR thresholding

Example 3: Retro Computing Art from HDR Photography

Scenario: A digital artist creates retro-style 1-bit artwork by capturing real scenes in HDR and converting to XBM, leveraging HDR's dynamic range for artistic threshold effects.

Source: city_skyline.hdr (6.2 MB, 4000x2000, 32-bit RGBE)
Conversion: HDR → XBM (artistic threshold)
Result: city_skyline.xbm (48 KB, 640x320, 1-bit monochrome)

Creative workflow:
1. Capture cityscape in HDR for maximum tonal detail
2. Experiment with threshold levels for artistic effect
3. Convert to XBM at chosen threshold
4. Display in retro computing context or pixel art gallery
✓ HDR source gives rich tonal options for thresholding
✓ Different thresholds produce dramatically different art
✓ True 1-bit aesthetic from real-world photography

Frequently Asked Questions (FAQ)

Q: What happens to all the color and dynamic range in the HDR file?

A: The conversion applies tone mapping, then converts to grayscale, and finally applies a threshold to produce pure black and white. All color information is lost, and all grayscale gradation is reduced to two values. The threshold level determines the cutoff point — pixels brighter than the threshold become white, and darker pixels become black. This is an extreme reduction but produces clean, well-defined shapes from HDR sources.

Q: Why would I convert HDR to a 1-bit format?

A: The main use cases are: X11 cursor/icon creation where XBM is the native format; embedded systems where images must compile into C code without image libraries; and artistic purposes where 1-bit aesthetics are desired. The HDR source actually helps — its wide dynamic range provides cleaner edge detection during thresholding than standard 8-bit images, resulting in sharper silhouettes.

Q: Can I control the threshold level during conversion?

A: The automated conversion applies a standard 50% threshold for balanced results. For custom thresholds, you can use ImageMagick (magick input.hdr -auto-level -threshold 40% output.xbm) or Pillow in Python to set any threshold percentage. Lower thresholds preserve more bright detail, while higher thresholds keep only the darkest elements.

Q: What is the XBM file format structure?

A: XBM files are plain text C source code. They contain #define statements for width and height, optional hotspot coordinates for cursors, and a static unsigned char array with the bitmap data as hexadecimal values. Each byte encodes 8 pixels (LSB first). You can open an XBM file in any text editor, and it can be directly #include-d in C/C++ programs.

Q: Can web browsers display XBM files?

A: No modern web browsers support XBM display. Historically, some very early browsers (Netscape 1.x era) could display XBM, but this support was removed decades ago. XBM is designed for X11 applications and embedded systems, not web delivery. For web use, convert to PNG, WebP, or SVG instead.

Q: What is the difference between XBM and XPM?

A: XBM is monochrome (1-bit, black and white only) while XPM (X PixMap) supports up to 256 colors. Both are plain text formats used in the X Window System. XPM was created as a color extension of XBM. For icons needing color, XPM is the better choice within the X11 ecosystem; XBM is used when only two colors are needed, such as cursors and monochrome indicators.

Q: How large can an XBM image be?

A: There is no hard limit in the format specification, but XBM is designed for small images — typically 16x16, 32x32, or 64x64 pixels for cursors and icons. Larger images are technically possible but impractical because XBM has no compression. A 1024x1024 XBM file would be about 400 KB of text, while equivalent binary formats would be only 128 KB. Use XBM only for icon-sized images.

Q: Can I include the converted XBM directly in my C program?

A: Yes, that is one of XBM's defining features. The output file is a valid C header containing #define directives and a static unsigned char array. Simply #include "icon.xbm" in your C/C++ source code, and the bitmap data is available at compile time without any file I/O or image decoding at runtime. This is why XBM remains valuable for embedded and resource-constrained applications.