XPM Format Guide
Available Conversions
Convert XPM color pixmaps to AVIF for modern web delivery with maximum compression
Convert XPM pixmaps to BLP for Blizzard game engine texture pipelines
Convert XPM to BMP format for Windows compatibility and uncompressed storage
Convert XPM pixmaps to DDS for GPU-compressed game engine textures
Convert XPM to EPS for professional print and prepress workflows
Convert X PixMap images to OpenEXR for VFX compositing
Convert XPM to GIF format for web graphics and legacy compatibility
Convert XPM images to HDR for high dynamic range imaging
Convert XPM pixmaps to ICNS for macOS application icons
Convert XPM to ICO for Windows icons and website favicons
Convert XPM to JPEG 2000 for professional and scientific applications
Convert XPM to JPG for universal compatibility and easy sharing
Convert XPM color pixmaps to MSP monochrome bitmap format
Convert XPM pixmaps to ZSoft Paintbrush format for legacy applications
Convert XPM to PNG for lossless raster quality with transparency support
Convert XPM pixmaps to Portable Pixmap format for image processing
Convert XPM pixmaps to QOI for fast lossless compression
Convert XPM pixmaps to SGI for VFX compositing and rendering pipelines
Convert XPM to TGA for game development and 3D rendering pipelines
Convert XPM to TIFF for professional editing and archival purposes
Convert XPM to WebP for optimized web image delivery
Convert XPM color pixmaps to XBM monochrome bitmaps for X11
About XPM Format
XPM (X PixMap) is a color image format created in 1989 by Daniel Dardailler at Groupe Bull for the X Window System (X11). It is the color extension of the earlier XBM (X BitMap) format, designed to store color pixmaps as plain C source code. Like XBM, XPM files can be directly #included in C and C++ programs and compiled as part of the application binary, but unlike XBM's monochrome-only limitation, XPM supports up to 256 colors through a palette-based encoding system. Each XPM file defines a character-to-color mapping table followed by rows of character strings that represent pixel data, where each character (or group of characters) corresponds to a specific color in the palette. The format supports symbolic color names, hexadecimal RGB values, and even multiple color representations for different display types (monochrome, grayscale, color). XPM also supports one transparent color, making it suitable for icons and UI elements that need to blend with their background. XPM files use the .xpm file extension and are valid C source code that defines a static array of character strings.
History of XPM
The XPM format was developed in 1989 by Daniel Dardailler at Groupe Bull, a French computer company that was an active contributor to X Window System development. The format was created to address the fundamental limitation of XBM: its restriction to monochrome (1-bit) images. While XBM served well for simple icons and cursors, the growing sophistication of X11 desktop environments demanded color pixmaps for toolbar buttons, application icons, file type indicators, and other graphical UI elements. Dardailler designed XPM to retain XBM's key advantage of storing images as compilable C source code while adding support for multiple colors, transparency, and named color symbolism. The format went through three major revisions: XPM1 (1989), XPM2 (1991, simplified syntax), and XPM3 (1993, the current version with full feature set). XPM became the de facto standard for color icons in the X11 ecosystem, widely adopted by window managers like Motif (MWM), FVWM, AfterStep, and WindowMaker, as well as by major X11 toolkits and applications. The libXpm library, maintained as part of the X.Org project, provides the reference implementation for reading and writing XPM files. While modern Linux desktops have largely transitioned to PNG and SVG for icons, XPM files remain common in legacy X11 applications, window manager themes, and embedded Linux systems.
Key Features and Uses
XPM files use a distinctive text-based structure consisting of a C static array of character strings. The first string contains four integers: width, height, number of colors, and characters per pixel (cpp). The following strings define the color table, mapping each character (or character group) to a color specification that can include symbolic names (like "background"), monochrome values (m), grayscale (g/g4), and color values (c) in formats such as named X11 colors (e.g., "red", "SteelBlue") or hexadecimal RGB notation (e.g., "#FF0000"). The remaining strings represent the pixel data row by row, where each pixel is encoded as one or more characters that reference the color table. The "None" color keyword designates transparency, allowing XPM icons to have irregularly shaped visible regions. This character-based encoding means that XPM images can be visually recognized in a text editor by developers familiar with the color mapping, making the format remarkably human-readable for a graphics format. XPM files are read and written by Pillow (Python), ImageMagick, GIMP, XnView, Inkscape, and the libXpm library, and are natively supported by X11 toolkits including Xt, Motif, Gtk+, and Qt.
Common Applications
XPM files have historically been the primary format for color icons in X Window System applications. In X11 window managers such as Motif, FVWM, AfterStep, WindowMaker, and IceWM, XPM pixmaps serve as application icons, toolbar buttons, desktop shortcuts, and theme decorations. The Common Desktop Environment (CDE), the standard Unix desktop of the 1990s, relied extensively on XPM for its icon set and UI graphics. Many classic X11 applications including xterm, Emacs, and Netscape Navigator used XPM for their toolbar and menu icons. In embedded Linux systems, XPM remains useful because the C source code representation allows graphics to be compiled directly into firmware without requiring an image loading library or file system access at runtime. The format is also encountered in retro computing projects, classic game resources, and educational contexts where the human-readable color mapping provides an excellent demonstration of palette-based image encoding. Converting XPM files to modern formats like PNG is common when migrating legacy X11 applications to modern toolkits like Gtk3/4 or Qt5/6, extracting icons from vintage Unix software for documentation or archival purposes, or preparing legacy graphics for web display.
Advantages and Disadvantages
Advantages
- Color Support: Supports up to 256 colors via palette-based encoding, a major upgrade from XBM's monochrome
- Directly Compilable: Can be #included in C/C++ programs and compiled as part of the application binary
- Human-Readable: Stored as plain text C source code, editable in any text editor
- Transparency Support: Supports one transparent color for non-rectangular icons and UI elements
- Symbolic Colors: Named color references allow theme-aware icon rendering
- Multi-Visual Support: Can define different color mappings for color, grayscale, and monochrome displays
- No Parsing Library Required: C compiler handles the data directly when compiled into applications
- Version Control Friendly: Text-based format produces meaningful diffs in version control systems
- Universal X11 Support: Natively supported by all major X11 toolkits and window managers
- Embedded Systems Ready: C source code format ideal for compiled-in graphics on resource-constrained devices
Disadvantages
- 256 Color Limit: Maximum palette size of 256 colors, insufficient for photographs or complex gradients
- Large File Sizes: Text encoding is significantly larger than binary formats for equivalent image data
- Single Transparent Color: Only one color can be designated transparent, no alpha channel support
- Not Suitable for Photos: Cannot represent photographs or images with more than 256 unique colors
- Limited Modern Ecosystem: Primarily confined to legacy X Window System applications
- No Compression: Does not support any form of data compression
- No Metadata Standards: Does not support EXIF, IPTC, XMP, or other metadata frameworks
- No Animation: Cannot store animated image sequences in a single file
- Security Concerns: Historical vulnerabilities in XPM parsing libraries (libXpm buffer overflows)
- Not Web-Compatible: Cannot be displayed natively in web browsers