X PixMap

X PixMap
Some text editors, for example gvim, can display xpm images in graphical form
Filename extension
.xpm
Internet media type
image/x-xpixmap[1]
Developed byBULL Research
Type of formatImage file formats
Extended fromXBM
Open format?yes

X PixMap (XPM) is an image file format used by the X Window System, created in 1989 by Daniel Dardailler and Colas Nahaboo working at Bull Research Center at Sophia Antipolis, France, and later enhanced by Arnaud Le Hors.[2][3]

It is intended primarily for creating icon pixmaps, and supports transparent pixels. Derived from the earlier XBM syntax, it is a plain text file in the XPM2 format or of a C programming language syntax, which can be included in a C program file.[2]

History

XPM1

The first (1989) XPM format is relatively similar to the XBM format.[a] Compared to XBM, it uses additional macro definitions and variables for indexed colors, and replaces bits with characters for describing the image. The following is a black-and-white image in the 1989 XPM format.

#define XFACE_format 1
#define XFACE_width 48
#define XFACE_height 48
#define XFACE_ncolors 2
#define XFACE_chars_per_pixel 1
static char *XFACE_colors[] = {
"a", "#ffffff",
"b", "#000000"
};
static char *XFACE_pixels[] = {
"abaabaababaaabaabababaabaabaababaabaaababaabaaab",
// and so on for 48 rows with 48 pixels

XPM2

XPM2 (1990) simplifies the format by removing all C code.[b][c] The structure is simplified to

! XPM2
<Values>
<Colors>
<Pixels>
<Optional Extensions>
  • The value section describes the overall dimension of the image similar to the #define statements.
  • The color section defines the values, and a new concept of the "type" of the color. The types may be c for "color", m for "monochrome" output, g for "grayscale", and s for "symbolic", explaining what a defined color is supposed to do.
  • The pixels and optional extensions remain as in the original format.

The above file, with width 48, height 4, 2 colors, and 1 character per pixel, becomes:

! XPM2
48 4 2 1
a c #FFFFFF
b c #000000
abaabaababaaabaabababaabaabaababaabaaababaabaaab
abaabaababaaabaabababaabaabaababaabaaababaabaaab
abaabaababaaabaabababaabaabaababaabaaababaabaaab
abaabaababaaabaabababaabaabaababaabaaababaabaaab

Colors

In addition to hexcodes, the colors can be any of the X11 color names. In addition, None indicates transparency.[4][5]

The "symbolic" feature permits adjusting colors depending on the context where they are used. Code such as s border c blue could be adjusted on a blue background.

Many-color encoding

One tool is known to use only a to p for 16 colors, switching to aa up to dp for 64 colors, but still reading single character encodings for 64 colors; compare Base64.

With more colors the codes use more characters, e.g. aa up to pp for 16 × 16 = 256 colors. This is less useful for text editors, because a string ab could be actually the middle of two adjacent pixels dabc. Spaces are allowed as color code, but might be a bad idea depending on the used text editor. Without control codes, backslash, and quote (needed in XPM1 and XPM3) 128 − 33 − 2 = 93 ASCII characters are available for single character color codes.

Simplified example: 90 US-ASCII characters could be arranged into nine non-overlapping sets of 10 characters. Thus unambiguous strings of nine characters could set the color of each pixel by its XPM palette index with up to 109 = 1000000000 colors (compare to GIF, which supports only 256).

For XPM2 it is clear how many lines belong to the image – two header lines, the second header line announcing the number of color codes (2 lines in the example above) and rows (height 4 in the example above), e.g. 2 + 2 + 4 = 8 lines.

XPM3

The current and last format is XPM3 (1991). It re-introduces the C wrapper, but instead of explicitly showing a file's structure, the strings stored are essentially identical to XPM2.

/* XPM */
static char * XFACE[] = {
"48 4 2 1",
"a c #ffffff",
"b c #000000",
"abaabaababaaabaabababaabaabaababaabaaababaabaaab",
"abaabaababaaabaabababaabaabaababaabaaababaabaaab",
"abaabaababaaabaabababaabaabaababaabaaababaabaaab",
"abaabaababaaabaabababaabaabaababaabaaababaabaaab"
};

If the "values" line contains six instead of four numbers, the additional values indicate the coordinates of a "hotspot", where 0 0 is the upper left corner of a box containing the icon and the default. A "hotspot" is used for mouse pointers and similar applications.

Comparison with other formats

Blarg file opened in program window

The following code displays the same blarg file in the XBM, XPM and PBM formats.

XBM version:

#define test_width 16
#define test_height 7
static char test_bits[] = {
0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
0x00, 0x60 };
Blarg.xpm (XPM2) rendered by XnView

XPM2 version:

! XPM2
16 7 2 1
* c #000000
. c #ffffff
**..*...........
*.*.*...........
**..*..**.**..**
*.*.*.*.*.*..*.*
**..*..**.*...**
...............*
.............**.

XPM3 version:

/* XPM */
static char * blarg_xpm[] = {
"16 7 2 1",
"* c #000000",
". c #ffffff",
"**..*...........",
"*.*.*...........",
"**..*..**.**..**",
"*.*.*.*.*.*..*.*",
"**..*..**.*...**",
"...............*",
".............**."
};

PBM file:

P1
16 7
1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0
1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 1 0 0 1 1 0 1 1 0 0 1 1
1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1
1 1 0 0 1 0 0 1 1 0 1 0 0 0 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0

Application support

ACDSee, Amaya, CorelDRAW, GIMP, ImageMagick, IrfanView (formats plugin), PaintShop Pro, PMView, Photoshop (plugins), and XnView among others support XPM.[6][7] Gravatar and picons also support XPM.[8][9]

An X11 libXpm vulnerability was fixed in 2005,[10] and three more in 2023.[11]

FFmpeg version 3.3 or later can decode XPM.[12]

See also

  • Netpbm – Toolkit for manipulation of images
  • CLUT – In computer graphics, a finite set of available colors

Notes

  1. ^ For a description of this format in lieu of the manual (not found on the Internet), use xpm-contrib (formerly part of libXpm proper) converter (xpm2ppm, xpm1to3, xpm1to2c) source code.
  2. ^ It is also acceptable to use programming language syntaxes for string arrays, but only the C syntax is attested. The "XPM2 C" syntax eventually became the only format in XPM version 3.
  3. ^ For references on this syntax, see https://gitlab.freedesktop.org/xorg/lib/libxpm/-/blob/master/NEWS.old and the "history" section of libXpm 3.4 manual.

References

  1. ^ .xpm MIME type not registered at IANA
  2. ^ a b Le Hors, Arnaud (1996-02-01). XPM Manual: The X PixMap Format (PDF). Groupe Bull. pp. 7–8. Retrieved 2014-01-01.
  3. ^ Daniel Dardailler (1996-07-15). "The XPM Story". Colas Nahaboo and Arnaud Le Hors. Archived from the original on 1997-06-07. Retrieved 2014-01-01.
  4. ^ "The XPM FAQ". X.Org Foundation. 1996. Retrieved 2016-03-12.
  5. ^ Murray, James D.; Vanryper, William (1996). XPM File Format Summary. O'Reilly & Associates. ISBN 1-56592-161-5. Retrieved 2014-01-01. {{cite book}}: |work= ignored (help)
  6. ^ Nir Sofer. ".xpm Extension". Retrieved 2014-01-12.
  7. ^ "File Type: X Windows Pixmap". Windows File Association. Microsoft. 2013. Retrieved 2014-01-12.
  8. ^ Gravatar unofficial, no XPM2
  9. ^ Steve Kinzler (2005). "Picons Archive". Retrieved 2014-01-06. picons are in either monochrome XBM format or color XPM and GIF formats
  10. ^ "libXpm library contains multiple integer overflow vulnerabilities". US-CERT. 2005-10-06. VU#537878. Retrieved 2014-01-01.
  11. ^ "X.Org Security Advisory: Issues handling XPM files in libXpm prior to 3.5.15". 2023-01-17.
  12. ^ "FFmpeg 3.3 "Hilbert"". FFmpeg. 2017-04-13. Retrieved 2017-10-28. XPM decoder

See also

Read other articles:

جابرييل تينتي   معلومات شخصية اسم الولادة (باللغات المتعددة: Gastone Tinti)‏  الميلاد 22 أغسطس 1932[1]  مولينيلا  الوفاة 12 نوفمبر 1991 (59 سنة) [1]  روما  سبب الوفاة نوبة قلبية  الإقامة روما  مواطنة إيطاليا (18 يونيو 1946–12 نوفمبر 1991) مملكة إيطاليا (22 أغسطس 1932–18 يوني

Місто Нортбороангл. Northboro Координати 40°36′28″ пн. ш. 95°17′29″ зх. д. / 40.6077777778057722° пн. ш. 95.2913888889167850° зх. д. / 40.6077777778057722; -95.2913888889167850Координати: 40°36′28″ пн. ш. 95°17′29″ зх. д. / 40.6077777778057722° пн. ш. 95.2913888889167850° зх. д. / 40...

Coordenadas: 45° 13' N 9° 20' E Magherno    Comuna   Localização MaghernoLocalização de Magherno na Itália Coordenadas 45° 13' N 9° 20' E Região Lombardia Província Pavia Características geográficas Área total 5 km² População total 1 378 hab. Densidade 276 hab./km² Altitude 76 m Outros dados Comunas limítrofes Copiano, Gerenzago, Torre d'Arese, Villanterio, Vistarino Código ISTAT 018085 Código postal 27010 Prefixo te...

Давидов Анатолій Іванович Народився 8 лютого 1938(1938-02-08)Бочечки, Конотопський район, Київська область, Українська РСР, СРСРПомер 5 січня 2002(2002-01-05) (63 роки)Київ, УкраїнаГромадянство  СРСР,  УкраїнаНаціональність українецьДіяльність письменник,Alma mater Ніжинський державн...

Ukraine War and War in Ukraine redirect here. For the ongoing war, see Russian invasion of Ukraine.This is a dynamic list and may never be able to satisfy particular standards for completeness. You can help by adding missing items with reliable sources. Part of a series on the History of Ukraine Prehistory Trypillian–Cucuteni culture Yamnaya culture Catacomb culture Cimmeria Taurica Scythia Bosporan Kingdom Sarmatia Zarubintsy culture Chernyakhov culture Hunnic Empire Early history Early Ea...

Rute Seremban 1  Kereta KTM Kelas 92 di KL SentralIkhtisarNama asliLaluan SerembanJenisKereta api komuterSistemKTM KomuterStatusBeroperasiLokasiSelangorKuala LumpurNegeri SembilanMalakaTerminusBatu Caves(Rawas)Stasiun26 + 3 stasiun cadanganLayananBatu Caves - (Rawas)Nomor lintas 1  (biru)Situs webwww.ktmb.com.myOperasiDibuka14 Agustus 1995 (1995-08-14)PemilikKeretapi Tanah MelayuOperatorKeretapi Tanah MelayuDepoSerembanRangkaianKTM Class 92 Komuter CSR EMU 37 kereta b...

This article relies largely or entirely on a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources.Find sources: Sanandaj Jewish Neo-Aramaic – news · newspapers · books · scholar · JSTOR (April 2021) Sanandaj Neo-AramaicLanguage familyAfro-Asiatic SemiticCentral SemiticNorthwest SemiticAramaicEastern AramaicNortheasternSanandaj Neo-AramaicLanguage codesISO 639-3...

VlogbrothersHank dan John di VidCon 2012Informasi pribadiNegaraAmerika SerikatPekerjaanWirausahawan, aktivis sosial, vlogger YouTubeInformasi YouTubeKanal vlogbrothers Tahun aktif2007–sekarangGenreVloggingPelanggan3.0 juta+[2]Total tayang711 juta+[2]Jaringantidak ada[1]Artis terkait Michael Aranda Craig Benzine Sabrina Cruz Esther Earl Emily Graslie Sarah Urist Green Hannah Hart Grace Helbig T. Michael Martin Rosianna Halse Rojas Penghargaan Kreator 100.000...

село Новосілки-Гостинні Країна  Україна Область Львівська область Район Самбірський район Громада Рудківська міська громада Код КАТОТТГ UA46080110000050484 Основні дані Засноване 1425 Перша згадка 1284 Населення 1457 Площа 11,18 км² Густота населення 125,22 осіб/км² Поштовий інде...

Protein-coding gene in the species Homo sapiens POU4F3IdentifiersAliasesPOU4F3, BRN3C, DFNA15, POU class 4 homeobox 3, DFNA42, DFNA52External IDsOMIM: 602460 MGI: 102523 HomoloGene: 2023 GeneCards: POU4F3 Gene location (Human)Chr.Chromosome 5 (human)[1]Band5q32Start146,338,839 bp[1]End146,341,728 bp[1]Gene location (Mouse)Chr.Chromosome 18 (mouse)[2]Band18 B3|18 22.58 cMStart42,527,604 bp[2]End42,530,314 bp[2]RNA expression patternBgeeHuman...

Wine made from grapes grown in Michigan, United States MichiganWine regionA view from Chateau Chantal on Michigan's Old Mission PeninsulaOfficial nameState of MichiganTypeU.S. stateYear established1837Years of wine industry1933-presentCountryUnited StatesSub-regionsFennville AVA, Lake Michigan Shore AVA, Leelanau Peninsula AVA, Old Mission Peninsula AVA, Tip of the Mitt AVAClimate regionContinentalTotal area97,990 square miles (253,793 km2)Size of planted vineyards3,375 acres (1,366 ...

Rakata Ubicación geográficaArchipiélago KrakatoaEstrecho Estrecho de la SondaCoordenadas 6°09′09″S 105°26′39″E / -6.1525, 105.444269Ubicación administrativaPaís IndonesiaDivisión Lampung MeridionalCaracterísticas generalesSuperficie 10,2 km²Punto más alto (820 metros)Mapa de localización Mapa del archipiélago con Rakata en Krakatoa[editar datos en Wikidata] Rakata (también conocida como Krakatoa) es una isla volcánica que funciona como est...

American paranormal reality television show Ghost AdventuresGenreParanormalRealityCreated byZak BagansWritten byZak BagansDevin LawrenceJeff BelangerNo. of seasons25No. of episodes274 (plus 53 specials excluded in the list) (list of episodes)ProductionExecutive producers Daniel A. Schwartz Joe Townley Michael Yudin Zak Bagans Producers Zak Bagans Amber Delly Production locations United States United Kingdom Italy Mexico Ireland Canada Jamaica Romania France Cinematography Zak Bagans Aaron Goo...

Wildlife tracking network A bumblebee with a transponder attached to its back. Motus (Latin for movement) is a network of radio receivers for tracking signals from transmitters attached to wild animals. Motus uses radio telemetry for real-time tracking. It was launched by Birds Canada in 2014 in the US and Canada. As of 2022[update], more than 1,500 receiver stations had been installed in 34 countries.[1] Most receivers are concentrated in the United States and Canada, where t...

2022 film by Karen Maine Not to be confused with Rosalie (1937 film). RosalineOfficial release posterDirected byKaren MaineScreenplay by Scott Neustadter Michael H. Weber Based onWhen You Were Mineby Rebecca Serle andRomeo and Julietby William ShakespeareProduced by Shawn Levy Dan Cohen Dan Levine Starring Kaitlyn Dever Isabela Merced Kyle Allen Sean Teale Christopher McDonald Minnie Driver Bradley Whitford CinematographyLaurie RoseEdited byJennifer LeeMusic by Drum & Lace Ian Hultquist P...

This article is about the Santa Cruz–based newspaper. For the San Francisco–based newspaper, see San Francisco Express Times § Good Times. Good TimesTypeAlternative weeklyFormatTabloidOwner(s)Metro NewspapersFounder(s)Jay ShorePublisherDan PulcranoPresidentDan PulcranoEditor-in-chiefSteve PalopoliFoundedApril 3, 1975[1]HeadquartersSanta Cruz, CaliforniaCirculation35,000[1]ISSN0164-4033OCLC number4708924 Websitegoodtimes.sc Good Times is a free-circulation weekly news...

Israel-related events during the year of 2004 ← 2003 2002 2001 2004 in Israel → 2005 2006 2007 Decades: 1980s 1990s 2000s 2010s 2020s See also: History of Israel Timeline of Israel history List of years in Israel Events in the year 2004 in Israel. Incumbents President of Israel – Moshe Katsav Prime Minister of Israel – Ariel Sharon President of the Supreme Court – Aharon Barak Chief of General Staff – Moshe Ya'alon to June 1 Dan Halutz Government of Israel – 30th Governm...

Los cantos polifónicos de los pigmeos aka de Centroáfrica Patrimonio cultural inmaterial de la Unesco Familia aka.LocalizaciónPaís República Centroafricana República CentroafricanaDatos generalesTipo Cultural inmaterialIdentificación 00082Región ÁfricaInscripción 2003 (como Obra Maestra del Patrimonio Oral e Intangible de la Humanidad, y como PCI en 2008, III sesión)[editar datos en Wikidata] Máscara aka, Museo Nacional de Antropología, Madrid, España. Los aka, bi...

Indian director, screenwriter and author Vivek Ranjan AgnihotriAgnihotri in 2019Born (1973-11-10) 10 November 1973 (age 50)Gwalior, Madhya Pradesh, India[1]CitizenshipIndianEducationIndian Institute of Mass CommunicationOccupationsFilm directorfilm producerscreenwriterauthorNotable workThe Kashmir FilesThe Tashkent FilesSpouse Pallavi Joshi ​(m. 1997)​Children2Websitevivekagnihotri.com Vivek Ranjan Agnihotri (born 10 November 1973)[2] is an In...

Book of commentary and translations from over 100 ancient and medieval yoga texts Roots of Yoga On the book's cover, a yogi practises tapkāra āsana, the ascetic's pose.AuthorJames MallinsonMark SingletonCountryLondon, UKSeriesPenguin ClassicsSubjectHistory of yogaGenreAnthologyPublisherPenguin BooksPublication date2017Pages540OCLC928480104 Roots of Yoga is a 2017 book of commentary and translations from over 100 ancient and medieval yoga texts, mainly written in Sanskrit but including sever...