XPM

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m (Sample files)
 
(11 intermediate revisions by 6 users not shown)
Line 2: Line 2:
 
|formattype=electronic
 
|formattype=electronic
 
|subcat=Graphics
 
|subcat=Graphics
|extensions={{ext|xpm}} {{ext|pm}}
+
|extensions={{ext|xpm}}, {{ext|pm}}, {{ext|c}}, {{ext|h}}
 +
|mimetypes={{mimetype|image/x-xpixmap}}
 
|pronom={{PRONOM|x-fmt/208}}
 
|pronom={{PRONOM|x-fmt/208}}
 +
|wikidata={{wikidata|Q1887604}}
 
|released=1989
 
|released=1989
 
}}
 
}}
 
'''X PixMap''' ('''XPM''') is an uncompressed raster image file format. It is essentially the color version of [[XBM]].
 
'''X PixMap''' ('''XPM''') is an uncompressed raster image file format. It is essentially the color version of [[XBM]].
  
An XPM file is plain text. Except for the little-used XPM version 2, it doubles as a fragment of [[C]] program code.
+
An XPM file is plain text. But some like the mentioned example <code>dframeIB.xpm</code> 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 <code>progressui_gtk_icon.h</code>
 +
or the suffix c as in the example <code>xpmputty.c</code>. 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.
 +
 
 +
== Identification ==
 +
X PixMap should start with 9 byte c-comment <code>/* XPM */</code>.
 +
All start with a c-comment, but in some non-standard examples the magic comment appears several hundred bytes later, as in the examples <code>mozicon16.xpm</code> or <code>mozicon50.xpm</code>.
 +
Or this comment is even completely missing as in the example <code>logo.xpm</code>.
 +
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 <code>mh-logo.xpm</code>.
 +
The character array is defined without explicit length specification.
 +
This can be recognized by the 2 byte sequence of square brackets <code>[]</code>.
 +
 
 +
== Specifications ==
 +
* [http://www.x.org/docs/XPM/xpm.pdf XPM Manual: The X PixMap Format, Version 3.4i]
  
 
== Software ==
 
== Software ==
* [http://netpbm.sourceforge.net/ Netpbm]
+
* [[Farbfeld Utilities]] (format 1, 2 (except Lisp mode), and 3)
* http://ftp.x.org/contrib/libraries/ → xpm-3.4k.tar.gz
+
* [[FFmpeg]]
 +
* [[ImageMagick]] (format 3 only)
 +
* [[Netpbm]]: ppmtoxpm, xpmtoppm (format 1 and 3)
 +
* 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]
 +
* [[GIMP]]
 +
* [http://www.irfanview.com/ IrfanView]
 +
* [https://www.libreoffice.org/ LibreOffice Draw]
 +
* [[XnView]]
  
 
== Sample files ==
 
== Sample files ==
 
* http://www.fileformat.info/format/xpm/sample/index.htm
 
* http://www.fileformat.info/format/xpm/sample/index.htm
 
* http://stuff.mit.edu/afs/athena/contrib/graphics/images/icons/
 
* http://stuff.mit.edu/afs/athena/contrib/graphics/images/icons/
 +
* {{DexvertSamples|image/xpm}}
 +
* https://www.qemu.org/ - [https://download.qemu.org/qemu-7.0.0-rc4.tar.xz qemu-7.0.0-rc4.tar.xz] → logo.xpm
 +
* http://ftp.mozilla.org/pub/thunderbird/ - [http://ftp.mozilla.org/pub/thunderbird/releases/60.5.3/source/thunderbird-60.5.3.source.tar.xz thunderbird-60.5.3.source.tar.xz] → mozicon16.xpm mozicon50.xpm
 +
* https://archive.apache.org/dist/openoffice/ - [https://archive.apache.org/dist/openoffice/4.1.7/source/apache-openoffice-4.1.7-46059c9192-src.zip apache-openoffice-4.1.7-46059c9192-src.zip] →  aoo-4.1.7/main/padmin/source/ psetupl.xpm
 +
* http://raspbian.raspberrypi.org/ - [http://raspbian.raspberrypi.org/raspbian/pool/main/i/icewm-themes/icewm-themes_1.2.26.orig.tar.gz icewm-themes_1.2.26.orig.tar.gz] → icewm-themes-1.2.26/gnomeish/ dframeIB.xpm
 +
* http://ftp.gnu.org/gnu/emacs/ - [http://ftp.gnu.org/gnu/emacs/emacs-28.1.tar.gz emacs-28.1.tar.gz] →  emacs-28.1/etc/images/ mh-logo.xpm
 +
* https://the.earth.li/~sgtatham/putty/0.76/ [https://the.earth.li/~sgtatham/putty/latest/putty-0.76.tar.gz putty-0.76.tar.gz] →  putty-0.76/unix/ xpmputty.c
 +
* https://www.libreoffice.org/download/download/ [https://download.documentfoundation.org/libreoffice/src/7.3.2/libreoffice-7.3.2.2.tar.xz libreoffice-7.3.2.2.tar.xz] → libreoffice-7.3.2.2/onlineupdate/source/update/updater/ progressui_gtk_icon.h
  
 
== External links ==
 
== External links ==
* [http://www.fileformat.info/format/xpm/egff.htm 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]]

Latest revision as of 04:21, 28 December 2023

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

[edit] 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 [].

[edit] Specifications

[edit] Software

[edit] Sample files

[edit] External links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox