ImageGear for Java User Guide > ImageGear Imaging Formats Reference > ImageGear Supported File Formats Reference > XPM |
Full Name | XPM (X PixMap) |
Format ID | ImGearFormats.XPM |
File Extension(s) | *.xpm |
Data Type | Raster Image |
Data Encoding | ASCII (in C language syntax) |
IG Multipage Support | No |
IG Alpha Channel Support | No |
IG Platforms Support | WIN32, WIN64, Linux32, Linux64, MAC32, MAC64 |
None
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.
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.