In
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
, the
X Window System
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
used X BitMap (XBM), a
plain text
In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects ( floating-point numbers, images, etc.). It may also include a lim ...
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two values (0 and 1) for each digit
* Binary function, a function that takes two arguments
* Binary operation, a mathematical op ...
image format, for storing
cursor and
icon
An icon () is a religious work of art, most commonly a painting, in the cultures of the Eastern Orthodox, Oriental Orthodox, Catholic Church, Catholic, and Lutheranism, Lutheran churches. The most common subjects include Jesus, Mary, mother of ...
bitmap
In computing, a bitmap (also called raster) graphic is an image formed from rows of different colored pixels. A GIF is an example of a graphics image file that uses a bitmap.
As a noun, the term "bitmap" is very often used to refer to a partic ...
s used in the X
GUI. The XBM format is superseded by
XPM, which first appeared for
X11
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
in 1989.
Format
XBM files differ markedly from most image files in that they take the form of
C source files. This means that they can be compiled directly into an application without any preprocessing steps, but it also makes them far larger than their raw pixel data. The image data is encoded as a comma-separated list of byte values, each written in the C hexadecimal notation, '0x13' for example, so that multiple ASCII characters are used to express a single byte of image information.
XBM data consists of a series of static unsigned char
arrays
An array is a systematic arrangement of similar objects, usually in rows and columns.
Things called an array include:
{{TOC right
Music
* In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
containing the monochrome
pixel
In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a Raster graphics, raster image, or the smallest addressable element in a dot matrix display device. In most digital display devices, p ...
data. When the format was in common use, an XBM typically appeared in
headers (.h files) which featured one array per image stored in the header. The following piece of C code exemplifies the XBM file ''Blarg'' displayed in the panel at right:
#define test_width 16
#define test_height 7
static unsigned char test_bits[] = ;
In place of the usual image-file-format header, XBM files has two or four #define statements. The first two #defines specify the height and width of the bitmap in pixels. The second two, if any, specify the position of any hotspot within the bitmap. (In the case of bitmapped cursors, the "hotspot" refers to the position of the cursor "point", generally at 0,0.)
XBM image data consists of a line of pixel values stored in a static array. Because a single
bit
The bit is the most basic unit of information in computing and digital communication. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented as ...
represents each pixel (0 for white or 1 for black), each byte in the array contains the information for eight pixels, with the upper left pixel in the bitmap represented by the low bit of the first byte in the array. If the image width does not match a multiple of 8, the extra bits in the last byte of each row are ignored.
Support
Some
web browser
A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
s support displaying XBM images as a holdover from the early days of the
World Wide Web
The World Wide Web (WWW or simply the Web) is an information system that enables Content (media), content sharing over the Internet through user-friendly ways meant to appeal to users beyond Information technology, IT specialists and hobbyis ...
, when XBM was the minimal non-proprietary image file format. The
Arena
An arena is a large enclosed venue, often circular or oval-shaped, designed to showcase theatre, Music, musical performances or Sport, sporting events. It comprises a large open space surrounded on most or all sides by tiered seating for specta ...
web browser had full support since version 0.3.34 (25 July 1997). XBM support was removed from
Internet Explorer 6,
Mozilla Firefox 3.6, and
WebKit
WebKit is a browser engine primarily used in Apple's Safari web browser, as well as all web browsers on iOS and iPadOS. WebKit is also used by the PlayStation consoles starting with the PS3, the Tizen mobile operating systems, the Amazon K ...
-based browsers. There is a strong indication that
Chromium
Chromium is a chemical element; it has Symbol (chemistry), symbol Cr and atomic number 24. It is the first element in Group 6 element, group 6. It is a steely-grey, Luster (mineralogy), lustrous, hard, and brittle transition metal.
Chromium ...
(and therefore, also,
Google Chrome
Google Chrome is a web browser developed by Google. It was first released in 2008 for Microsoft Windows, built with free software components from Apple WebKit and Mozilla Firefox. Versions were later released for Linux, macOS, iOS, iPadOS, an ...
) does not support XBM. Documentation for
Opera
Opera is a form of History of theatre#European theatre, Western theatre in which music is a fundamental component and dramatic roles are taken by Singing, singers. Such a "work" (the literal translation of the Italian word "opera") is typically ...
2.12 and 6.0 indicates that XBM was at least previously supported.
Some image viewers/converters, e.g.,
XnView
XnView is an image organizer and general-purpose file manager used for viewing, converting, organizing and editing raster images, as well as general purpose file management. It comes with built-in hex inspection, batch renaming, image scan ...
,
FFmpeg
FFmpeg is a free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the command-line ffmpeg tool itself, designed for processing vide ...
and
IrfanView
IrfanView () is an image viewer, editor, organiser and converter program for Microsoft Windows. It can also play video and audio files, and has some image creation and painting capabilities. IrfanView is free for non-commercial use; commercial ...
, support XBM. A 48×48 XBM can be converted to ''Ikon'' and eventually
X-Face with
Netpbm
Netpbm (formerly Pbmplus) is an open-source software, open-source package of graphics programs and a programming library. It is used primarily in Unix, where it is found in all major open-source operating system distributions, but also works on M ...
tools.
Despite having been superseded by the
XPM format, XBM is still used by some modern but lightweight
window manager
A window manager is system software that controls the placement and appearance of window (computing), windows within a windowing system in a graphical user interface. Most window managers are designed to help provide a desktop environment. They ...
s like
Openbox to define simple button images in a window's title bar, such as the iconify/minimize, restore, and maximize buttons. XBM is also used in embedded processing (microControllers) to display Icons used in GUIs.
ImageMagick
ImageMagick, invoked from the command line as magick, is a free and open-source cross-platform software suite for displaying, creating, converting, modifying, and editing raster images. ImageMagick was created by John Cristy in 1987, and it ...
supports converting images both to and from XBM.
GIMP
Gimp or GIMP may refer to:
Clothing
* Bondage suit, also called a gimp suit, a type of suit used in BDSM
* Bondage mask, also called a gimp mask, often worn in conjunction with a gimp suit
Embroidery and crafts
* Gimp (thread), an ornamental tr ...
may be used to create or modify images using the XBM format, and also supports converting images to and from the XBM format.
See also
*
X PixMap (XPM)
*
Xlib
Xlib (also known as libX11) is an X Window System protocol client library (computer science), library written in the C (programming language), C programming language. It contains subroutine, functions for interacting with an X Server (computi ...
*
Portable Bit Map (PBM)
References
{{Graphics file formats
Graphics file formats
X Window System
Articles with example C code