XPM

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Identification and more unusual samples for other extensions added)
(add link to libXpm gitlab, update current release tarball name, change "The XPM story" link to archived page since original is now gone)
Line 39: Line 39:
 
* [[ImageMagick]] (format 3 only)
 
* [[ImageMagick]] (format 3 only)
 
* [[Netpbm]]: ppmtoxpm, xpmtoppm (format 1 and 3)
 
* [[Netpbm]]: ppmtoxpm, xpmtoppm (format 1 and 3)
* http://www.x.org/releases/individual/lib/ → libXpm-3.5.11.tar.gz
+
* libXpm:
 +
** https://gitlab.freedesktop.org/xorg/lib/libxpm
 +
** http://www.x.org/releases/individual/lib/ → libXpm-3.5.14.tar.gz
 
* [http://snisurset.net/code/abydos/ abydos]
 
* [http://snisurset.net/code/abydos/ abydos]
 
* [[GIMP]]
 
* [[GIMP]]
Line 60: Line 62:
 
== External links ==
 
== External links ==
 
* {{EGFF|xpm|XPM File Format Summary}}, from the [[Encyclopedia of Graphics File Formats]]
 
* {{EGFF|xpm|XPM File Format Summary}}, from the [[Encyclopedia of Graphics File Formats]]
* [http://www.w3.org/People/danield/xpm_story.html The XPM Story]
+
* [https://web.archive.org/web/20181114053701/http://www.w3.org/People/danield/xpm_story.html The XPM Story]
 
* [[Wikipedia:X PixMap|Wikipedia article]]
 
* [[Wikipedia:X PixMap|Wikipedia article]]
  
 
[[Category:X Window System]]
 
[[Category:X Window System]]

Revision as of 19:32, 29 December 2022

File Format
Name XPM
Ontology
Extension(s) .xpm, .pm, .c, .h
MIME Type(s) image/x-xpixmap
PRONOM x-fmt/208
Wikidata ID Q1887604
Released 1989

X PixMap (XPM) is an uncompressed raster image file format. It is essentially the color version of XBM.

An XPM file is plain text. But some like the mentioned example dframeIB.xpm contain special characters like zero-byte or Control-Z at the end. These then no longer represent pure ASCII text, which leads to malfunction of some programs. Except for the little-used XPM version 2, it doubles as a fragment of C program code. Therefore, instead of the usual extension xpm for the file name, you can also find the suffix h as in the example progressui_gtk_icon.h or the suffix c as in the example xpmputty.c. In some cases these also contain other C expressions. Unfortunately, this leads to some confusion. On some systems, such examples are now considered as C header text or C source text based on the file extension. When trying to edit them, they are usually opened with a text editor like Emacs or vi. On other systems, however, the examples are viewed as X pixmap files based on the magic comment. When trying to edit them, they are then usually opened with an image editor.

Contents

Identification

X PixMap should start with 9 byte c-comment /* XPM */. All start with a c-comment, but in some non-standard examples the magic comment appears several hundred bytes later, as in the examples mozicon16.xpm or mozicon50.xpm. Or this comment is even completely missing as in the example logo.xpm. Most programs cannot handle these variants, but some software like ImageMagick or IrfanView can. Therefore, one should also check the part defined as C program code. This begins with the two consecutive words static char, which are separated by white space. This can be combinations of spaces and tabulation characters, but usually one space is used. This string is often found a few thousand bytes after the beginning as in the example mh-logo.xpm. The character array is defined without explicit length specification. This can be recognized by the 2 byte sequence of square brackets [].

Specifications

Software

Sample files

External links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox