X Pixmap (XPM)

 

General Description

XPM is a text based bitmap format that is primarily intended for storage of color cursor and icon bitmaps for use in the X graphics user interface. The data is formatted and stored as a C language file and can directly be compiled into a software program.

 

Supporting Platforms and Applications

This format is popular under UNIX for storage of color icon bitmaps.

 

PMView Support

PMView supports XPM versions 1, 2, and 3. Colors may be defined by name or by RGB value (4, 8, or 12-bit/component). HSV is currently not supported. XPM version 2 and 3 files begin with a comment (usually /* XPM2 C */ for version 2 files and /* XPM */ for version 3 files).

 

XPM1 notes

When reading XPM1 (version 1) files, PMView scans the first 20 rows and seeks for the width, height, color count, and characters per pixel definitions. PMView uses the following definitions when reading XPM1 files:

 

#define FOO_width

#define FOO_height

#define FOO_ncolors

#define FOO_chars_per_pixel

static char * FOO_colors[] = { ... }

static char * FOO_pixels[] = { ... }

 

Where FOO is the name of the pixmap.

 

If PMView cannot find the first four definitions within the 20 first rows of the file, it will stop searching and not accept the file as a valid XPM1 file (though it is still possible that it is valid). The file may, for instance, have more than 20 lines of C language source code before the definitions and bitmap data. If this is the case you can edit the file with a standard text editor and move the bitmap definition to the beginning of the file in order to make PMView recognize it as an XPM1 file.