ImageGear for C and C++ on Linux v18.8 - Updated
XPM
User Guide > File Formats and Compressions > File Formats > File Formats Reference > XPM

Full Name XPM (X PixMap)
Format ID IG_FORMAT_XPM = 45
File Extension(s) *.xpm
Data Type Raster Image
Data Encoding ASCII (in C language syntax)
Color Profile Support No
Multi-Page Support No
Alpha Channel Support No
ImageGear Platforms Support WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC

ImageGear Supported Versions:

ImageGear Supported Features:

ImageGear Read Support:

ImageGear Write Support:

ImageGear Filter Control Parameters:

None

Comments:

The XPM format was created as an extended version of the XBM file format. It is the informal standard for storing X Window pixmap data, including Hotspot information for cursor bitmaps. The image data is stored in ASCII text characters that are formatted as a standard C array of character strings. It is intended to be human-readable, is readily inserted into C/C++ program code, and can contain any number of comment lines. It therefore does not support a native compression scheme. If compacting is desired, an external compression program may be used. See also XBM, XWD.

All XPM files begin with a C language comment line containing "XPM". Following this are three sections of data: values, colors, and pixels, and an optional fourth section: extensions. The "values" section is the equivalent of the header structure typically found in a graphics file. It gives the size of the pixmap, as well as its number of colors, characters per pixel, the location of the Hotspot (if any), and an indicator of whether the file contains an extension section. Each section is set off with a comment-line title.

The colors section contains codes for the pixmap data characters. All pixels that make up the pixmap are assigned to one or more ASCII characters and one or more colors. (e.g. the character "X" may be assigned to the color red). There are several different conventions for identifying a color. If the string "None" appears as the color to be applied to a specific character, the character(s) symbolizes a transparent pixel.

The "pixels" section contains the bitmap data that appear as an array of character strings, where one row of bitmap data is represented by one array element. Each row is a group of characters set off by quotation marks. Each character is defined in the previous "colors" section.

If indicated by the values section, an extension section appears. It can contain one or more subsections that conform to one of two syntactical formats. An "XPMENDEXT" marker is always used to mark the end of the extension section.

References Used

Brown, C. Wayne, and Barry J. Shepherd. Graphics File Formats: Reference and Guide. Greenwich, CT.: Manning Publications, 1992.

Murray, James D. and William vanRyper. Encyclopedia of Graphics File Formats. Sebastopol, CA: O'Reilly & Associates, Inc., 1994.