In
computer graphics
Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
, 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 provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wit ...
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 limit ...
binary
Binary may refer to:
Science and technology Mathematics
* Binary number, a representation of numbers using only two digits (0 and 1)
* Binary function, a function that takes two arguments
* Binary operation, a mathematical operation that t ...
image format
An Image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be ...
, for storing
cursor
Cursor may refer to:
* Cursor (user interface), an indicator used to show the current position for user interaction on a computer monitor or other display device
* Cursor (databases), a control structure that enables traversal over the records in ...
and
icon
An icon () is a religious work of art, most commonly a painting, in the cultures of the Eastern Orthodox, Oriental Orthodox, and Catholic churches. They are not simply artworks; "an icon is a sacred image used in religious devotion". The most ...
bitmap
In computing, a bitmap is a mapping from some domain (for example, a range of integers) to bits. It is also called a bit array
A bit array (also known as bitmask, bit map, bit set, bit string, or bit vector) is an array data structure that c ...
s used in the X
GUI
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
. 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 provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wi ...
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 image, or the smallest point in an all points addressable display device.
In most digital display devices, pixels are the smal ...
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 an XBM file:
#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 communications. 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 represente ...
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 is application software 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 screen. Browsers are used on ...
s support displaying XBM images as a holdover from the early days of the
World Wide Web
The World Wide Web (WWW), commonly known as the Web, is an information system enabling documents and other web resources to be accessed over the Internet.
Documents and downloadable media are made available to the network through web se ...
, when XBM was the minimal non-proprietary image file format. The
Arena
An arena is a large enclosed platform, often circular or oval-shaped, designed to showcase theatre, musical performances, or sporting events. It is composed of a large open space surrounded on most or all sides by tiered seating for spectators ...
web browser had full support since version 0.3.34 (25 July 1997). XBM support was removed from
Internet Explorer 6
Microsoft Internet Explorer 6 (IE6) is a graphical web browser developed by Microsoft for Windows operating systems. Released on August 24, 2001, it is the sixth, and by now discontinued, version of Internet Explorer and the successor to Internet ...
,
Mozilla Firefox 3.6
Mozilla Firefox 3.6 is a version of the Firefox web browser released in January 2010. The release's main improvement over Firefox 3.5 is improved performance (due to further speed improvements in the TraceMonkey JavaScript engine). It uses the Ge ...
, and
WebKit
WebKit is a browser engine developed by Apple and primarily used in its Safari web browser, as well as on the iOS and iPadOS version of any web browser. WebKit is also used by the BlackBerry Browser, PlayStation consoles beginning from the PS ...
-based browsers. There is a strong indication that
Chromium
Chromium is a chemical element with the symbol Cr and atomic number 24. It is the first element in group 6. It is a steely-grey, lustrous, hard, and brittle transition metal.
Chromium metal is valued for its high corrosion resistance and hardne ...
(and therefore, also,
Google Chrome
Google Chrome is a cross-platform 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 ...
) does not support XBM. Documentation for
Opera
Opera is a form of theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a librett ...
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 and screen ...
,
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 of vid ...
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 u ...
, support XBM. A 48×48 XBM can be converted to ''Ikon'' and eventually
X-Face
An X-Face is a small bitmap (48 × 48 pixels, black and white) image which is added to a Usenet posting or e-mail message, typically showing a picture of the author's face. The image data is included in the posting as encoded text, and attached ...
with
Netpbm
Netpbm (formerly Pbmplus) is an open-source package of graphics programs and a programming library. It is used mainly in the Unix world, where one can find it included in all major open-source operating system distributions, but also works on Mic ...
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 windows within a windowing system in a graphical user interface. Most window managers are designed to help provide a desktop environment. They work in conjunction ...
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
supports converting images both to and from XBM.
GIMP
GIMP ( ; GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image manipulation (retouching) and image editing, free-form drawing, transcoding between different image file formats, and more specialized task ...
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 written in the C programming language. It contains functions for interacting with an X server. These functions allow programmers to write programs without knowing the ...
*
Portable Bit Map (PBM)
References
{{Graphics file formats
Graphics file formats
X Window System
Articles with example C code